Skip to content

Instantly share code, notes, and snippets.

@nkreiger
Created June 3, 2020 02:35
Show Gist options
  • Select an option

  • Save nkreiger/021cea454b9a920903e26ec1b9f67c08 to your computer and use it in GitHub Desktop.

Select an option

Save nkreiger/021cea454b9a920903e26ec1b9f67c08 to your computer and use it in GitHub Desktop.
const app = require('express')();
const bodyParser = require('body-parser');
// parse to json
app.use(bodyParser.json());
app.use(bodyParser.urlencoded({ extended: false }));
// get from redis
app.get('/:key', (req, res) => {
console.log(req.params);
// send response
res.send({
status: 200,
message: 'Ok'
})
});
// write to redis
app.post('/send', (req, res) => {
// log out body
console.log(req.body);
// send response
res.send({
status: 200,
message: 'Ok'
})
});
app.listen(3000, () => {
console.log('App listening on port 3000!');
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment