Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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
You can’t perform that action at this time.