Skip to content

Instantly share code, notes, and snippets.

@irony
Created December 2, 2014 07:44
Show Gist options
  • Save irony/d8f4a00caeedcb5dbadd to your computer and use it in GitHub Desktop.
Save irony/d8f4a00caeedcb5dbadd to your computer and use it in GitHub Desktop.
enkel api setup
var storage = {};
var express = require('express')
var app = express()
app.post('/:id', function(req,res){
storage[req.id] = req.body;
res.json(true);
});
app.delete('/:id', function(req,res){
delete storage[req.id];
res.json(true);
});
app.get('/:id', function(req,res){
res.json(storage[req.id]);
});
app.get('/', function(req,res){
res.send('Store data with post,get,delete on route /:id');
});
app.listen(3000);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment