Giter Site home page Giter Site logo

restapi's Introduction

RestAPI

RestAPI

prerequisites :

  • mongodb 3.2
  • node 4.x
  • mocha ( for running test cases )

Used

  • ES6 generators
  • co
  • mongoose ( ODM )

RestAPIDemo

Welcome to [post] to "http://localhost:3000/getAccess" with {name : "admin" , pass : "admin"} to get Access token

================= API Usage =================

GetACCESS-Token :

POST[public] : "http://localhost:3000/getAccess" with {name : "admin" , pass : "admin"}

exampleToken : eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJuYW1lIjoiYWRtaW4iLCJwYXNzd29yZCI6ImFkbWluIiwiaWF0IjoxNDU4OTE5MDM5LCJleHAiOjE0NTg5MjI2Mzl9.ORZmUH47HPjTKh4R1BmyvakHAjTDuaDzkpLR9CxjwBs

Add:

POST[public][ADD] : "http://localhost:3000/location/:victimClient" ( body : {lat & long} ) will store in DB, returns 201 & location header

( Note : All Private API need access token to do operation )

GetAllClients:

GET[private][RETRIVE] : "http://localhost:3000/location" returns JSON of all clients in DB

GetSingleClient:

GET[private][RETRIVE] : "http://localhost:3000/location/:victimClient" returns victimClient

UpdateClientRecord:

PUT[private][UPDATE] : "http://localhost:3000/location/:victimClient" ( body : {lat & long} ) update long&lat for editing purpose, returns 201 & location header

Edit/Delete:

DELETE[private][DEL] : "http://localhost:3000/location/:victimClient" deletes victimClient and returns 204

================= Run Server: =================

>> npm install #installs deps
>> npm run start #starts the server on localhost 3000 port

================= Run Test cases: =================

>> npm run tests

restapi's People

Watchers

Kam 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.