-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
pauliescanlon
committed
Sep 11, 2022
1 parent
7e9797f
commit 98055a1
Showing
3 changed files
with
104 additions
and
66 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
const { PrismaClient, Prisma } = require('@prisma/client'); | ||
|
||
export default async function handler(req, res) { | ||
const { id } = JSON.parse(req.body); | ||
|
||
const prisma = new PrismaClient({ | ||
datasources: { | ||
db: { | ||
url: process.env.DATABASE_URL | ||
} | ||
} | ||
}); | ||
|
||
try { | ||
const response = await prisma.locations.delete({ | ||
where: { | ||
id: BigInt(id) | ||
} | ||
}); | ||
|
||
res.status(200).json({ | ||
message: 'A-OK!', | ||
data: { | ||
id: id | ||
} | ||
}); | ||
} catch (error) { | ||
res.status(500).json({ message: 'Error!' }); | ||
} finally { | ||
prisma.$disconnect(); | ||
} | ||
} |
98055a1
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully deployed to the following URLs:
cockroachdb-edge-locations – ./
cockroachdb-edge-locations-pauliescanlon.vercel.app
cockroachdb-edge-locations-git-main-pauliescanlon.vercel.app
cockroachdb-edge-locations.vercel.app