This is a simple todo server that uses a REST API to manage todos.
It is written in:
- Typescript
- Hono as the server framework
- SQLite as the database
To run the server, you need to have Node.js installed. Then you can run the following commands:
bun dev
This will start the server on port 3000.
The server has the following API:
This will return a list of all the todos.
This will create a new todo. The body of the request should be a JSON object with the following properties:
taskName
: The name of the tododescription
: `: A description of the todo
This will update a todo. The body of the request should be a JSON object with the following properties:
id
: The id of the todotaskName
: The name of the tododescription
: `: A description of the todo
This will delete a todo. The body of the request should be a JSON object with the following properties:
id
: The id of the todo
The Delete method uses Hono's Route Validation using regex so that it will only ever accept integers as the id. Otherwise the method will return a 404 Not Found error.
The server uses SQLite as the database. The database is created when you first run the application and is stored in the db
folder
The intial database is created with a single table called todos
with the following schema:
CREATE TABLE todos (
id INTEGER PRIMARY KEY AUTOINCREMENT,
taskName VARCHAR(255),
description TEXT
);
You can see the database schema in the db
folder within the Todos.sql
file.