https://github.com/jonathan-foucher/deno-api-example
An example of API with Deno
https://github.com/jonathan-foucher/deno-api-example
deno sequelize typescript
Last synced: 2 months ago
JSON representation
An example of API with Deno
- Host: GitHub
- URL: https://github.com/jonathan-foucher/deno-api-example
- Owner: jonathan-foucher
- Created: 2024-10-31T20:04:09.000Z (over 1 year ago)
- Default Branch: master
- Last Pushed: 2024-11-02T14:25:30.000Z (over 1 year ago)
- Last Synced: 2025-01-08T20:22:59.104Z (over 1 year ago)
- Topics: deno, sequelize, typescript
- Language: TypeScript
- Homepage:
- Size: 13.7 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
## Introduction
This project is an example of Deno API with sequelize and a postgres database.
## Run the project
### Database
Install postgres locally or run it through docker with :
```
docker run -p 5432:5432 -e POSTGRES_DB=my_database -e POSTGRES_USER=postgres -e POSTGRES_PASSWORD=postgres postgres
```
### Application
Once the postgres database is started, you can start the Deno project and try it out.
Start the application
```
deno run dev
```
Get all the movies
```
curl --location 'http://localhost:3000/api/movies'
```
Save a movie
```
curl --request POST \
--url http://localhost:3000/api/movies \
--header 'Content-Type: application/json' \
--data '{
"id": 26,
"title": "Some movie title",
"release_date": "2022-02-26"
}'
```
Delete a movie
```
curl --request DELETE \
--url http://localhost:3000/api/movies/26
```