Coder Social home page Coder Social logo

todo-backend's Introduction

Todo App Backend

This is the backend REST API for the todo app https://github.com/Marie000/todo-frontend

Install instructions:

unzip or git clone run npm install

To start the server, using docker: docker-compose up This will run the server for the REST API and for the MongoDB database

The REST API

main url: 'http://localhost:9000'

Routes:

GET /todo-items

returns an array of todo-items e.g.

 [
   {
      "status": "pending",
      "_id": "5bb9003ece4c720028a1b19c",
      "title": "something",
      "createdAt": "2018-10-06T18:34:38.038Z",
      "updatedAt": "2018-10-06T18:34:38.038Z",
      "__v": 0
  },
  {
     "status": "done",
     "_id": "5bb90156d6af9d0046de4bfe",
     "title": "something else",
     "createdAt": "2018-10-06T18:39:18.512Z",
     "updatedAt": "2018-10-06T19:21:54.030Z",
     "__v": 0,
     "description": "this is a description",
     "completedAt": "2018-10-06T19:21:54.021Z"
  }
 ] 

GET /todo-items/file

returns a json file containing the list of todo-items

POST /todo-items

Creates a todo item

req.body should include the following fields:

title: String, required

description: String,

status: String, one of: "pending", "in process", "done", "archived", default: "pending"

NOTE: fields createdAt and updatedAt are set by the database.

field completedAt is set when an item is created with status equal to "done"

Returns the created Todo Item

PATCH /todo-items/:id

Updates a todo item with the corresponding id

req.body can include the following fields:

title: String,

description: String,

status: String, one of: "pending", "in process", "done", "archived"

Should only include fields that need to be updated. Fields set to null will not be updated.

NOTE: field updatedAt is set by the database

field completedAt is set when an item is updated to a status of "done"

Returns the updated Todo Item

TODOS

Possible improvements

Pagination, search, filter

The GET /todo-items currently returns all the items stored in the database. In the future, it should paginate the results and allow for search or filter options. In the future, the list might only include a few fields from each todo item (e.g. title and status but not description).

GET individual items

For the prototype, I do not excpect to need to request detailed information about a specific todo items. This might be necessary in the future depending on the data stored for each item and the use case in the front-end.

todo-backend's People

Contributors

marie000 avatar

Watchers

James Cloos avatar  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.