https://github.com/codeforgeek/deno-api-server
A simple Deno API server using MySQL and Oak. Only for study purpose.
https://github.com/codeforgeek/deno-api-server
api deno mysql
Last synced: about 2 months ago
JSON representation
A simple Deno API server using MySQL and Oak. Only for study purpose.
- Host: GitHub
- URL: https://github.com/codeforgeek/deno-api-server
- Owner: codeforgeek
- Created: 2020-06-05T10:41:54.000Z (about 6 years ago)
- Default Branch: master
- Last Pushed: 2020-06-05T10:58:24.000Z (about 6 years ago)
- Last Synced: 2025-06-12T13:06:52.156Z (about 1 year ago)
- Topics: api, deno, mysql
- Language: TypeScript
- Homepage: https://codeforgeek.com/building-api-server-using-deno-and-mysql/
- Size: 2.93 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
Awesome Lists containing this project
README
# Deno API Server
A simple API server using Deno, Oak and MySQL
## Run
Create a mysql database and create a table named ```users``` in it.
Here is the SQL.
```sql
CREATE TABLE users (
id int(11) NOT NULL AUTO_INCREMENT,
name varchar(100) NOT NULL,
created_at timestamp not null default current_timestamp,
PRIMARY KEY (id)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
```
Note: Make sure mysql credentials has no password, it is a WIP in a deno MySQL driver.
Run the Deno server.
```
deno run --allow-net --allow-env server.ts
```
## Routes
```
GET /api/v1/users
GET /api/v1/users/:id
POST /api/v1/users
PUT /api/v1/users/:id
DELETE /api/v1/users/:id
```