An open API service indexing awesome lists of open source software.

https://github.com/mraza007/express-api

This repo contains Todo-api built with ExpressJS
https://github.com/mraza007/express-api

Last synced: 4 months ago
JSON representation

This repo contains Todo-api built with ExpressJS

Awesome Lists containing this project

README

          

# Building JSON Api with Node and Mongo
This is a simple demonstrate how to build api using Node and Mongo.
In this I will be building A simple todo api.

## Defining Routes
- **GET** `/api/todos` List All Todos
- **POST** `api/todos` Create New Todo
- **GET** `api/todos/todoId` Retrieve a Todo
- **UPDATE** `api/todos/todoId` Update Todo
- **DELETE** `api/todos/todoId` Delete a Todo

## MongoDB Schema (Structing Todo Data)
- name `(type:string)`
- complete `(type:Boolean)`
- createdDate `(type:Date)`

## Getting Started with installation
- Make sure we have node installed.
- run `npm init` this will initialize.It contains meta data of our project
- install express js using `npm install express`.
- create a main file `touch index.js`.
- set up express in the file
- everything else will be in the `index.js` file