Merge pull request #126 from calcom/feat/improve-readme-deploy

feat: improve deployment docs for api
pull/9078/head
Agusti Fernandez Pardo 2022-06-16 03:11:32 +02:00 committed by GitHub
commit def5c8dd4c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 18 additions and 1 deletions

View File

@ -178,3 +178,20 @@ We make sure of this by not using next in dev, but next build && next start, if
See <https://github.com/vercel/next.js/blob/canary/packages/next/server/dev/hot-reloader.ts#L79>. Here in dev mode OPTIONS method is hardcoded to return only GET and OPTIONS as allowed method. Running in Production mode would cause this file to be not used. This is hot-reloading logic only.
To remove this limitation, we need to ensure that on local endpoints are requested by swagger at /api/v1 and not /v1
## Deployment
We recommend deploying API in vercel.
There's some settings that you'll need to setup.
Under Vercel > Your API Deployment > Settings
In General > Build & Development Settings
BUILD COMMAND: `yarn turbo run build --scope=@calcom/api --include-dependencies --no-deps`
OUTPUT DIRECTORY: `apps/api/.next`
See `scripts/vercel-deploy.sh` for more info on how the deployment is done.
## Environment variables
Lastly API requires an env var for `DATABASE_URL`

View File

@ -38,7 +38,7 @@ export async function deleteHandler(req: NextApiRequest) {
if (!isAdmin && query.userId !== req.userId)
throw new HttpError({ statusCode: 401, message: "Unauthorized" });
const user = await prisma.user.findUnique({ where: { id: query.id } });
const user = await prisma.user.findUnique({ where: { id: query.userId } });
if (!user) throw new HttpError({ statusCode: 404, message: "User not found" });
await prisma.user.delete({ where: { id: user.id } });