8000 GitHub - richard937/todoAPI
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

richard937/todoAPI

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

todoAPI

A backend API for todo application.
Tech Stack: NodeJS, PostgreSQL.

It supports following features:

  1. The user can create/read/update/delete todos.
  2. The user can search an existing todo by title/date/priority/state
  3. The user can prioritize the todos

CRUD Routes:

  1. Send a GET request to localhost:3000/todos to see all the todos.
  2. Send a POST request to localhost:3000/todos to CREATE a todo.
  3. Send a GET request to localhost:3000/todos/id/:id to READ a todo by the ID.
  4. Send a PUT request to localhost:3000/todos/id/:id to UPDATE a todo (description and priority).
  5. Send a PUT request to localhost:3000/todos/:title/complete to UPDATE a todo to mark complete by the Title.
  6. Send a DELETE request to localhost:3000/todos/id/:id to DELETE a todo by the ID.

Search Routes:

  1. Send a GET request to localhost:3000/todos/:title to Search by Title.
  2. Send a GET request to localhost:3000/todos/priority/:priority to Search by priority.
  3. Send a GET request to localhost:3000/todos/top/priority to find the top priority todo.
  4. Send a GET request to localhost:3000/todos/search/date to Search by Date.
  5. Send a GET request to localhost:3000/todos/search/incomplete to Search all Incomplete todos.
  6. Send a GET request to localhost:3000/todos/search/complete to Search all Complete todos.

DataBase Schema:

The schema for todo looks like this

todo {
    id,             // integer, primary key
    title,          // string
    description,    // string
    isCompleted,    // boolean
    priority,       // integer
    date            // date
}

Assumptions:

  1. while creating a todo user can provide title, description and priority.
  2. Priority is optional, the default priority is 1.
  3. date is the date of creation.
  4. date is assumed to be the date for todo to be done.
  5. Priority increases with the number.
  6. Different todos can have same priority.
  7. Title of the todo must be unique.

How to run:

  1. Clone the repo and do npm install to load the node modules.
  2. Should have Postgresql in your system, then create a user, it's password and database.
  3. Enter the credentials in server.js and models\toDoItem.js files.
  4. Uncomment line no 42 in todoItem.js.
  5. Hit node server.js to run.
  6. Comment line no 42 in todoItem.js.
  7. The app will run on localhost:3000/

**I took reference from this article for PostgreSQL: Link

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published
0