https://github.com/ekafyi/turso-vercel-functions-sample-api
Sample REST API with Turso + Drizzle on Vercel Serverless Functions
https://github.com/ekafyi/turso-vercel-functions-sample-api
drizzle drizzle-orm turso vercel-serverless vercel-serverless-functions
Last synced: about 1 month ago
JSON representation
Sample REST API with Turso + Drizzle on Vercel Serverless Functions
- Host: GitHub
- URL: https://github.com/ekafyi/turso-vercel-functions-sample-api
- Owner: ekafyi
- License: mit
- Created: 2023-11-06T14:51:02.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2023-11-06T15:12:04.000Z (over 1 year ago)
- Last Synced: 2025-03-29T17:41:30.394Z (2 months ago)
- Topics: drizzle, drizzle-orm, turso, vercel-serverless, vercel-serverless-functions
- Language: TypeScript
- Homepage:
- Size: 52.7 KB
- Stars: 4
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# [Turso](https://turso.tech) + [Drizzle](https://orm.drizzle.team) + [Vercel Serverless Functions](https://vercel.com/docs/functions/serverless-functions)
Fork of https://github.com/turso-extended/api-mug-store-api, using Vercel Serverless Functions instead of [Cloudflare Workers](https://developers.cloudflare.com/workers/)
See details in [original code](https://github.com/turso-extended/api-mug-store-api).
## Deploy to Vercel
[](https://vercel.com/new/clone?repository-url=https%3A%2F%2Fgithub.com%2Fekafyi%2turso-vercel-functions-sample-api)
Use the one-click deploy above OR setup locally from CLI:
1. Install [Vercel CLI](https://vercel.com/docs/cli)
2. Run `vercel` in the project directory; follow the instructions to create a new Vercel projectAdd your Turso credentials to [Vercel project env variables](https://vercel.com/docs/projects/environment-variables)
Docs: https://vercel.com/docs/deployments/overview
## Example
POST /api/mugs
```sh
curl --request POST \
--url http://localhost:3000/api/mugs \
--header 'Content-Type: application/json' \
--data '{
"name": "Lorem Mug",
"description": "Consectetur sunt culpa reprehenderit voluptate pariatur nulla esse fugiat ipsum",
"price": 1.23,
"category_id": "aab5c2dd-1141-4f71-bdc2-c6344f52e174"
}'
```DELETE /api/mugs/:id
```sh
curl --request DELETE \
--url http://localhost:3000/api/mugs/REPLACE_WITH_MUG_ID \
--header 'Content-Type: application/json' \
--data '{}'
```Replace `http://localhost:3000` with your base URL.