GithubHelp home page GithubHelp logo

simple-todo-server's Introduction

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:

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:

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.

simple-todo-server's People

Contributors

radhirasho avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.