Last active
January 13, 2020 13:49
-
-
Save ramisalem/2352965879bd0f0bab56aab821f8cefd to your computer and use it in GitHub Desktop.
Payfort APIs
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
const express = require('express'); | |
const bodyParser = require('body-parser'); | |
const app = express(); | |
app.use(bodyParser.json()); | |
app.use(bodyParser.urlencoded({ extended: true })); // support encoded bodies | |
app.post('/', (req, res) => { | |
console.log(req, 'body'); | |
console.log(req.body.token_name); | |
try { | |
req.body.token_name ? res.status(200).send(req.body.token_name) : res.status(401).send(""); | |
} catch (err) { | |
return res.status(422).send(" no body provided "); | |
} | |
}); | |
app.post('/proceed', (req, res) => { | |
console.log(req.body.status , 'status '); | |
try { | |
res.status(200).send(req.body.status); | |
} catch (err) { | |
return res.status(422).send("no body provided"); | |
} | |
}); | |
app.listen(process.env.PORT || 3000, () => { | |
console.log('Listening on port 3000'); | |
}); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment