-
Notifications
You must be signed in to change notification settings - Fork 211
Updated to use Vercel Postgres + Suspense streaming + Metadata API #22
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
beec61a
Updated to use Vercel Postgres + Suspense streaming + Metadata API
steven-tey f8d5a6c
Update README.md
steven-tey 428a95a
remove yarn lock
steven-tey 60d2707
oops
steven-tey 18d89a7
fix
steven-tey e2480ac
Update tsconfig.json
steven-tey 1e0e727
Update package.json
steven-tey File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
10 changes: 8 additions & 2 deletions
.env.example
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,11 @@ | ||
# Create a MySQL database with 2 clicks (no account needed): https://railway.app/ | ||
DATABASE_URL="mysql://johndoe:randompassword@localhost:5432/mydb?schema=public" | ||
# Create a Postgres database on Vercel: https://vercel.com/postgres | ||
POSTGRES_URL= | ||
POSTGRES_PRISMA_URL= | ||
POSTGRES_URL_NON_POOLING= | ||
POSTGRES_USER= | ||
POSTGRES_HOST= | ||
POSTGRES_PASSWORD= | ||
POSTGRES_DATABASE= | ||
|
||
# Generate one here: https://generate-secret.vercel.app/32 (only required for localhost) | ||
NEXTAUTH_SECRET= |
10 changes: 5 additions & 5 deletions
README.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
12 changes: 5 additions & 7 deletions
pages/api/auth/register.ts → app/api/auth/register/route.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,26 +1,24 @@ | ||
import prisma from "@/lib/prisma"; | ||
import { NextApiRequest, NextApiResponse } from "next"; | ||
import { hash } from "bcrypt"; | ||
import { NextResponse } from "next/server"; | ||
|
||
export default async function handler( | ||
req: NextApiRequest, | ||
res: NextApiResponse | ||
) { | ||
const { email, password } = req.body; | ||
export async function POST(req: Request) { | ||
const { email, password } = await req.json(); | ||
const exists = await prisma.user.findUnique({ | ||
where: { | ||
email, | ||
}, | ||
}); | ||
if (exists) { | ||
res.status(400).send("User already exists"); | ||
return NextResponse.json({ error: "User already exists" }, { status: 400 }); | ||
} else { | ||
const user = await prisma.user.create({ | ||
data: { | ||
email, | ||
password: await hash(password, 10), | ||
}, | ||
}); | ||
res.status(200).json(user); | ||
return NextResponse.json(user); | ||
} | ||
} |
21 changes: 0 additions & 21 deletions
app/head.tsx
Oops, something went wrong.
27 changes: 24 additions & 3 deletions
app/layout.tsx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
5 changes: 3 additions & 2 deletions
app/login/page.tsx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file added
app/opengraph-image.png
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
5 changes: 3 additions & 2 deletions
app/register/page.tsx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3 changes: 0 additions & 3 deletions
components/toaster.tsx
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
12 changes: 2 additions & 10 deletions
next.config.js
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,4 @@ | ||
/** | ||
* @type {import('next').NextConfig} | ||
*/ | ||
const nextConfig = { | ||
reactStrictMode: true, | ||
experimental: { | ||
appDir: true, | ||
serverComponentsExternalPackages: ["prisma", "@prisma/client"], | ||
}, | ||
}; | ||
/** @type {import('next').NextConfig} */ | ||
const nextConfig = {}; | ||
|
||
module.exports = nextConfig; |
19 changes: 8 additions & 11 deletions
package.json
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.