const express = require('express') const bodyParser = require('body-parser') const app = express() const port = 3000 let token = ''; // parse application/x-www-form-urlencoded app.use(bodyParser.urlencoded({ extended: false })) // parse application/json // app.use(bodyParser.json()) app.get('/', function (req, res) { res.send('
' + token); }); app.post('/', function (req, res) { console.log(req.body); token = req.body.token; res.send('ok\n'); }); app.listen(port, () => console.log(`Example app listening on port ${port}!`))