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

JediSange/tipsapp

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Tips API Specs

Create a node.js application that uses MongoDB to store model data. The app has one REST endpoint - tips. This endpoint should handle:

  • GET /tips/
  • GET /tips/
  • POST /tips/
  • PUT /tips/
  • DELETE /tips/

A ‘tip’ shall consist of:

  • id (unique)
  • Timestamp when tip was created
  • Timestamp of last tip update
  • Message
  • Original message (first message submitted for a tip)
  • Username of submitter

GET methods should implement a reasonable HTTP caching scheme.

Requirements

This assumes that you have NodeJS and NPM installed via the command line. At time of writing, I am using the following versions:

  • node v0.12.2
  • npm v2.9.0

Installing

npm install

Running

node server.js

Testing

I used Postman to test the API. Specifically the Chrome packaged app. With this, use the following keys:

  • message
  • username

Considerations and Improvements

  • Chose not to use Mongo's _id, instead went for tip_id
  • "use strict", should consider taking out for deployment
  • The foreach in POST for /tips is naive, and more consideration should probably be had for partial updates? or batch-saving only if error-free run through
  • I am particularly happy with the "createOrFetch" static method on the Tip model. It uses Node's paradigm of callbacks and error handling in a very fun way.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published
0