Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/radhirasho/simple-todo-server
Experimenting with SQLite and HonoJS
https://github.com/radhirasho/simple-todo-server
experiment honojs sqlite
Last synced: 4 days ago
JSON representation
Experimenting with SQLite and HonoJS
- Host: GitHub
- URL: https://github.com/radhirasho/simple-todo-server
- Owner: RadhiRasho
- Created: 2024-03-06T14:46:14.000Z (10 months ago)
- Default Branch: master
- Last Pushed: 2024-07-18T13:18:01.000Z (6 months ago)
- Last Synced: 2024-11-09T15:07:27.581Z (2 months ago)
- Topics: experiment, honojs, sqlite
- Language: TypeScript
- Homepage:
- Size: 1.38 MB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Simple Todo Server
This is a simple todo server that uses a REST API to manage todos.
It is written in:
1. Typescript
2. Hono as the server framework
3. SQLite as the database## Running the server
To run the server, you need to have Node.js installed. Then you can run the following commands:
```bash
bun dev
```This will start the server on port 3000.
## API
The server has the following API:
### GET /
This will return a list of all the todos.
### POST /create
This will create a new todo. The body of the request should be a JSON object with the following properties:
1. `taskName`: The name of the todo
2. `description`: `: A description of the todo### POST /update
This will update a todo. The body of the request should be a JSON object with the following properties:
1. `id`: The id of the todo
2. `taskName`: The name of the todo
3. `description`: `: A description of the todo### DELETE /delete/:id
This will delete a todo. The body of the request should be a JSON object with the following properties:
1. `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.## Database
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:```sql
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.