Skip to content

Commit

Permalink
Update to latest sveltekit with http method name change
Browse files Browse the repository at this point in the history
  • Loading branch information
silentworks committed Jul 16, 2022
1 parent 33879c6 commit 7c94d16
Show file tree
Hide file tree
Showing 14 changed files with 408 additions and 315 deletions.
11 changes: 6 additions & 5 deletions examples/sveltekit-email-password/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
"version": "0.0.0",
"private": true,
"scripts": {
"dev": "svelte-kit dev --port 3002",
"build:example": "svelte-kit build",
"dev": "vite dev --port 3002",
"build:example": "vite build",
"package": "svelte-kit package",
"preview": "svelte-kit preview",
"preview": "vite preview",
"check": "svelte-check --tsconfig ./tsconfig.json",
"check:watch": "svelte-check --tsconfig ./tsconfig.json --watch",
"lint": "prettier --ignore-path .gitignore --check --plugin-search-dir=. . && eslint --ignore-path .gitignore .",
Expand All @@ -15,7 +15,7 @@
},
"devDependencies": {
"@sveltejs/adapter-auto": "next",
"@sveltejs/kit": "1.0.0-next.350",
"@sveltejs/kit": "1.0.0-next.377",
"@typescript-eslint/eslint-plugin": "^5.10.1",
"@typescript-eslint/parser": "^5.10.1",
"eslint": "^7.32.0",
Expand All @@ -29,7 +29,8 @@
"svelte-preprocess": "^4.10.1",
"tsconfig": "workspace:*",
"tslib": "^2.3.1",
"typescript": "~4.5.4"
"typescript": "~4.5.4",
"vite": "^3.0.0"
},
"type": "module",
"dependencies": {
Expand Down
2 changes: 1 addition & 1 deletion examples/sveltekit-email-password/src/routes/dashboard.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ interface GetOutput {
data: TestTable[];
}

export const get: RequestHandler<GetOutput> = async ({ locals, request }) =>
export const GET: RequestHandler<GetOutput> = async ({ locals, request }) =>
withApiAuth(
{
redirectTo: '/',
Expand Down
4 changes: 2 additions & 2 deletions examples/sveltekit-email-password/src/routes/index.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import type { RequestHandler } from './__types/index';
import { supabaseClient } from '$lib/db';

export async function get({ locals }: { locals: App.Locals }) {
export async function GET({ locals }: { locals: App.Locals }) {
if (locals.user) {
return {
status: 303,
Expand All @@ -15,7 +15,7 @@ export async function get({ locals }: { locals: App.Locals }) {
};
}

export async function post({ request }: { request: Request }) {
export async function POST({ request }: { request: Request }) {
const data = await request.formData();

const email = data.get('email') as string;
Expand Down
9 changes: 9 additions & 0 deletions examples/sveltekit-email-password/vite.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
// vite.config.js
import { sveltekit } from '@sveltejs/kit/vite';

/** @type {import('vite').UserConfig} */
const config = {
plugins: [sveltekit()]
};

export default config;
11 changes: 6 additions & 5 deletions examples/sveltekit-magic-link/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
"version": "0.0.0",
"private": true,
"scripts": {
"dev": "svelte-kit dev --port 3003",
"build:example": "svelte-kit build",
"dev": "vite dev --port 3003",
"build:example": "vite build",
"package": "svelte-kit package",
"preview": "svelte-kit preview",
"preview": "vite preview",
"check": "svelte-check --tsconfig ./tsconfig.json",
"check:watch": "svelte-check --tsconfig ./tsconfig.json --watch",
"lint": "prettier --ignore-path .gitignore --check --plugin-search-dir=. . && eslint --ignore-path .gitignore .",
Expand All @@ -15,7 +15,7 @@
},
"devDependencies": {
"@sveltejs/adapter-auto": "next",
"@sveltejs/kit": "1.0.0-next.350",
"@sveltejs/kit": "1.0.0-next.377",
"@typescript-eslint/eslint-plugin": "^5.10.1",
"@typescript-eslint/parser": "^5.10.1",
"eslint": "^7.32.0",
Expand All @@ -29,7 +29,8 @@
"svelte-preprocess": "^4.10.1",
"tsconfig": "workspace:*",
"tslib": "^2.3.1",
"typescript": "~4.5.4"
"typescript": "~4.5.4",
"vite": "^3.0.0"
},
"type": "module",
"dependencies": {
Expand Down
2 changes: 1 addition & 1 deletion examples/sveltekit-magic-link/src/routes/dashboard.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ interface GetOutput {
data: TestTable[];
}

export const get: RequestHandler<GetOutput> = async ({ locals, request }) =>
export const GET: RequestHandler<GetOutput> = async ({ locals, request }) =>
withApiAuth(
{
redirectTo: '/',
Expand Down
4 changes: 2 additions & 2 deletions examples/sveltekit-magic-link/src/routes/index.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { supabaseClient } from '$lib/db';

export async function get({ locals }: { locals: App.Locals }) {
export async function GET({ locals }: { locals: App.Locals }) {
if (locals.user) {
return {
status: 303,
Expand All @@ -14,7 +14,7 @@ export async function get({ locals }: { locals: App.Locals }) {
};
}

export async function post({ request }: { request: Request }) {
export async function POST({ request }: { request: Request }) {
const data = await request.formData();

const email = data.get('email') as string;
Expand Down
9 changes: 9 additions & 0 deletions examples/sveltekit-magic-link/vite.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
// vite.config.js
import { sveltekit } from '@sveltejs/kit/vite';

/** @type {import('vite').UserConfig} */
const config = {
plugins: [sveltekit()]
};

export default config;
11 changes: 6 additions & 5 deletions examples/sveltekit/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
"version": "0.0.0",
"private": true,
"scripts": {
"dev": "svelte-kit dev --port 3001",
"build:example": "svelte-kit build",
"dev": "vite dev --port 3001",
"build:example": "vite build",
"package": "svelte-kit package",
"preview": "svelte-kit preview",
"preview": "vite preview",
"check": "svelte-check --tsconfig ./tsconfig.json",
"check:watch": "svelte-check --tsconfig ./tsconfig.json --watch",
"lint": "prettier --ignore-path .gitignore --check --plugin-search-dir=. . && eslint --ignore-path .gitignore .",
Expand All @@ -15,7 +15,7 @@
},
"devDependencies": {
"@sveltejs/adapter-auto": "next",
"@sveltejs/kit": "1.0.0-next.350",
"@sveltejs/kit": "1.0.0-next.377",
"@typescript-eslint/eslint-plugin": "^5.10.1",
"@typescript-eslint/parser": "^5.10.1",
"eslint": "^7.32.0",
Expand All @@ -30,7 +30,8 @@
"svelte-preprocess": "^4.10.1",
"tsconfig": "workspace:*",
"tslib": "^2.3.1",
"typescript": "~4.5.4"
"typescript": "~4.5.4",
"vite": "^3.0.0"
},
"type": "module",
"dependencies": {
Expand Down
2 changes: 1 addition & 1 deletion examples/sveltekit/src/routes/api/protected-route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ interface GetOutput {
data: TestTable[];
}

export const get: RequestHandler<GetOutput> = async ({ locals, request }) =>
export const GET: RequestHandler<GetOutput> = async ({ locals, request }) =>
withApiAuth({ user: locals.user }, async () => {
const { data } = await supabaseServerClient(request).from<TestTable>('test').select('*');

Expand Down
2 changes: 1 addition & 1 deletion examples/sveltekit/src/routes/github-provider-token.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ interface GetOutput {
allRepos: GitHubOutput;
}

export const get: RequestHandler<GetOutput> = async ({ locals, request }) =>
export const GET: RequestHandler<GetOutput> = async ({ locals, request }) =>
withApiAuth(
{
redirectTo: '/',
Expand Down
2 changes: 1 addition & 1 deletion examples/sveltekit/src/routes/profile.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ interface GetOutput {
user: User;
}

export const get: RequestHandler<GetOutput> = async ({ locals }) =>
export const GET: RequestHandler<GetOutput> = async ({ locals }) =>
withApiAuth(
{
redirectTo: '/',
Expand Down
9 changes: 9 additions & 0 deletions examples/sveltekit/vite.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
// vite.config.js
import { sveltekit } from '@sveltejs/kit/vite';

/** @type {import('vite').UserConfig} */
const config = {
plugins: [sveltekit()]
};

export default config;
Loading

0 comments on commit 7c94d16

Please sign in to comment.