Skip to content

Commit de08ae5

Browse files
committed
netlify example
and fix #3
1 parent 05dd041 commit de08ae5

23 files changed

+3073
-1
lines changed

examples/ioredis/src/routes/api/logout/+server.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import { sessionManager } from '$lib/session';
55
export const POST = (async ({ request, locals, cookies }) => {
66
if (locals && locals.isUserLoggedIn) {
77
const { email } = await request.json();
8-
const deleteData = await sessionManager.delSession(cookies);
8+
const deleteData = await sessionManager.deleteSession(cookies);
99
if (deleteData.error) await sessionManager.deleteCookie(cookies);
1010
return json({ loggedIn: false, message: 'Successfully logged out' });
1111
}

examples/node/.gitignore

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
.DS_Store
2+
node_modules
3+
/build
4+
/dist
5+
/.svelte-kit
6+
/package
7+
.env
8+
.env.*
9+
!.env.example
10+
vite.config.js.timestamp-*
11+
vite.config.ts.timestamp-*
12+
.idea

examples/node/README.md

+38
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
# create-svelte
2+
3+
Everything you need to build a Svelte project, powered by [`create-svelte`](https://github.com/sveltejs/kit/tree/master/packages/create-svelte).
4+
5+
## Creating a project
6+
7+
If you're seeing this, you've probably already done this step. Congrats!
8+
9+
```bash
10+
# create a new project in the current directory
11+
npm create svelte@latest
12+
13+
# create a new project in my-app
14+
npm create svelte@latest my-app
15+
```
16+
17+
## Developing
18+
19+
Once you've created a project and installed dependencies with `npm install` (or `pnpm install` or `yarn`), start a development server:
20+
21+
```bash
22+
npm run dev
23+
24+
# or start the server and open the app in a new browser tab
25+
npm run dev -- --open
26+
```
27+
28+
## Building
29+
30+
To create a production version of your app:
31+
32+
```bash
33+
npm run build
34+
```
35+
36+
You can preview the production build with `npm run preview`.
37+
38+
> To deploy your app, you may need to install an [adapter](https://kit.svelte.dev/docs/adapters) for your target environment.

examples/node/package.json

+40
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
{
2+
"name": "node-netlify",
3+
"version": "0.0.1",
4+
"private": true,
5+
"scripts": {
6+
"dev": "vite dev --host",
7+
"build": "vite build",
8+
"build:pac": "cd ../.. && pnpm install && pnpm build && cd examples/ioredis && pnpm build",
9+
"preview": "vite preview",
10+
"test": "playwright test",
11+
"check": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json",
12+
"check:watch": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json --watch",
13+
"lint": "prettier --plugin-search-dir . --check . && eslint .",
14+
"format": "prettier --plugin-search-dir . --write ."
15+
},
16+
"devDependencies": {
17+
"@playwright/test": "^1.37.1",
18+
"@sveltejs/adapter-vercel": "^2.4.3",
19+
"@sveltejs/kit": "^1.23.0",
20+
"@typescript-eslint/eslint-plugin": "^5.62.0",
21+
"@typescript-eslint/parser": "^5.62.0",
22+
"eslint": "^8.48.0",
23+
"eslint-config-prettier": "^8.10.0",
24+
"eslint-plugin-svelte3": "^4.0.0",
25+
"ioredis": "^5.3.2",
26+
"prettier": "^2.8.8",
27+
"prettier-plugin-svelte": "^2.10.1",
28+
"svelte": "^4.0.0",
29+
"svelte-check": "^3.5.0",
30+
"svelte-french-toast": "^1.2.0",
31+
"tslib": "^2.6.2",
32+
"typescript": "^5.0.0",
33+
"vite": "^4.4.9"
34+
},
35+
"type": "module",
36+
"dependencies": {
37+
"@ethercorps/sveltekit-redis-session": "link:../../",
38+
"redis": "^4.6.10"
39+
}
40+
}

examples/node/playwright.config.ts

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
import type { PlaywrightTestConfig } from '@playwright/test';
2+
3+
const config: PlaywrightTestConfig = {
4+
webServer: {
5+
command: 'npm run build && npm run preview',
6+
port: 4173
7+
},
8+
testDir: 'tests'
9+
};
10+
11+
export default config;

0 commit comments

Comments
 (0)