Spaces:
Running
Running
Isitha Tennakoon commited on
Commit ·
e398af3
1
Parent(s): ae44544
database connection works
Browse files
keygenServer/server/.gitignore
CHANGED
|
@@ -36,4 +36,5 @@ yarn-error.log*
|
|
| 36 |
|
| 37 |
# OS specific
|
| 38 |
.DS_Store
|
| 39 |
-
Thumbs.db
|
|
|
|
|
|
| 36 |
|
| 37 |
# OS specific
|
| 38 |
.DS_Store
|
| 39 |
+
Thumbs.db
|
| 40 |
+
/server/generated/prisma
|
keygenServer/server/prisma/schema.prisma
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
// This is your Prisma schema file,
|
| 2 |
+
// learn more about it in the docs: https://pris.ly/d/prisma-schema
|
| 3 |
+
|
| 4 |
+
// Looking for ways to speed up your queries, or scale easily with your serverless or edge functions?
|
| 5 |
+
// Try Prisma Accelerate: https://pris.ly/cli/accelerate-init
|
| 6 |
+
|
| 7 |
+
generator client {
|
| 8 |
+
provider = "prisma-client-js"
|
| 9 |
+
}
|
| 10 |
+
|
| 11 |
+
datasource db {
|
| 12 |
+
provider = "postgresql"
|
| 13 |
+
url = env("DATABASE_URL")
|
| 14 |
+
directUrl = env("DIRECT_URL") // Add this line yourself
|
| 15 |
+
}
|
| 16 |
+
|
| 17 |
+
model Key {
|
| 18 |
+
id String @id @default(uuid())
|
| 19 |
+
email String
|
| 20 |
+
apiKey String
|
| 21 |
+
createdAt DateTime @default(now())
|
| 22 |
+
}
|
keygenServer/server/server.ts
CHANGED
|
@@ -42,7 +42,7 @@ app.get('/api/public', cors(openCorsOptions), (req, res) => {
|
|
| 42 |
});
|
| 43 |
|
| 44 |
// Protected route with strict CORS and authentication
|
| 45 |
-
app.
|
| 46 |
cors(strictCorsOptions),
|
| 47 |
(req, res) => {
|
| 48 |
res.json({ message: 'Access granted to protected route' });
|
|
|
|
| 42 |
});
|
| 43 |
|
| 44 |
// Protected route with strict CORS and authentication
|
| 45 |
+
app.post('/api/addKey',
|
| 46 |
cors(strictCorsOptions),
|
| 47 |
(req, res) => {
|
| 48 |
res.json({ message: 'Access granted to protected route' });
|