Git Product home page Git Product logo

nodejs-api's Introduction

Introduction

Simple nodejs api that can perform the following tasks:

  1. Accept a key(string) and value(some json blob/string) {"key" : "value"} and store them. If an existing key is sent, the value should be updated

  2. Accept a key and return the corresponding latest value

  3. When given a key AND a timestamp (as query string), return whatever the value of the key at the time was.

  4. List all items.

Users Guide

End Point: https://nodejs-api-myce.herokuapp.com/

GET all the items

https://nodejs-api-myce.herokuapp.com/items

POST an item

https://nodejs-api-myce.herokuapp.com/items

body:

{
  key: 'your key',
  value: 'your value'
}

GET an item by [key]

https://nodejs-api-myce.herokuapp.com/[key]

GET an item by [key] and timestamp query string

https://nodejs-api-myce.herokuapp.com/[key]?timestamp=[epoch_time_in_second]

Developers Guide

npm version: 5.4.2

node version: 8.5.0

mongodb: mlab at https://mlab.com

Getting Started

  1. Create mongodb database
  2. Create a .env file in root project folder
  3. Add the following credential to the .env file

DB_URL=[YOUR_DB_URL]

DB_TEST_URL=[YOUR_TEST_DB_URL]

  1. Run npm install

  2. Run npm start

Test

Test framework: mocha, chai, chai-http

  1. Run npm test

nodejs-api's People

Contributors

martinyung avatar

Watchers

 avatar

Forkers

codejunction

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.