Created
June 3, 2020 02:35
-
-
Save nkreiger/021cea454b9a920903e26ec1b9f67c08 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| 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