Skip to content

Accepts POST requests and stores them. To get stored data, send a GET request.

License

Notifications You must be signed in to change notification settings

bitmorse/nervousnet-test-server

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

nervousnet-test-server

Accepts POST requests and stores them. To get stored data, send a GET request. Requires node 5.5+.

## Installation

  1. Clone this repository and cd to it.
  2. Run npm install.
  3. Run PORT=3000 npm start to start the server.

## Usage

  • Any JSON that is sent to http://localhost:3000 via POST will be stored:
    • curl -X POST -H "Content-Type:application/json" -d '{"foo":"bar"}'
  • Retrieve all data with a single GET request to:
    • http://localhost:3000
  • Data is persisted to disk in db.json.
  • Extend the server for more functionality by looking at the NDDB docs.
  • Watch the mini screencast.

Running on remote server for testing purposes

  • You can use c9.io for this (free), make sure to run below commands to get latest version of node on c9:
  • nvm install 5.5.0
  • nvm use 5.5.0
  • nvm alias default v5.5.0

Example JS code to post to server

$.ajax({ type: 'POST', processData: false, contentType: 'application/json', data: '{"name": "Guillaume"}', url: 'https://patrick-nervousnet-test-server-bitmorse.c9users.io:8080/', success: function(json) { console.log('/sayHello POST was successful.'); console.log(json); } });

About

Accepts POST requests and stores them. To get stored data, send a GET request.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published