-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: added next-auth and completed config for user auth
- Loading branch information
1 parent
2825cae
commit fe64de2
Showing
11 changed files
with
67 additions
and
98 deletions.
There are no files selected for viewing
This file contains 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 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 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 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 |
---|---|---|
@@ -0,0 +1,2 @@ | ||
import { handlers } from "@/auth"; | ||
export const { GET, POST } = handlers; |
This file contains 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 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 |
---|---|---|
@@ -0,0 +1,37 @@ | ||
// This approach is taken from https://github.com/vercel/next.js/tree/canary/examples/with-mongodb | ||
import { MongoClient, ServerApiVersion } from "mongodb"; | ||
|
||
if (!process.env.MONGODB_URI) { | ||
throw new Error('Invalid/Missing environment variable: "MONGODB_URI"'); | ||
} | ||
|
||
const uri = process.env.MONGODB_URI; | ||
const options = { | ||
serverApi: { | ||
version: ServerApiVersion.v1, | ||
strict: true, | ||
deprecationErrors: true, | ||
}, | ||
}; | ||
|
||
let client: MongoClient; | ||
|
||
if (process.env.NODE_ENV === "development") { | ||
// In development mode, use a global variable so that the value | ||
// is preserved across module reloads caused by HMR (Hot Module Replacement). | ||
const globalWithMongo = global as typeof globalThis & { | ||
_mongoClient?: MongoClient; | ||
}; | ||
|
||
if (!globalWithMongo._mongoClient) { | ||
globalWithMongo._mongoClient = new MongoClient(uri, options); | ||
} | ||
client = globalWithMongo._mongoClient; | ||
} else { | ||
// In production mode, it's best to not use a global variable. | ||
client = new MongoClient(uri, options); | ||
} | ||
|
||
// Export a module-scoped MongoClient. By doing this in a | ||
// separate module, the client can be shared across functions. | ||
export default client; |
This file was deleted.
Oops, something went wrong.
This file contains 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,2 +1,3 @@ | ||
export * from "./dbClientPromise"; | ||
// export * from "./prisma"; | ||
export * from "./MongoDBClient"; | ||
export * from "./connectDB"; | ||
export * from "./edgestore"; |
This file contains 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 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