Created
December 2, 2014 07:44
-
-
Save irony/d8f4a00caeedcb5dbadd to your computer and use it in GitHub Desktop.
enkel api setup
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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