callback

node v14.18.1
version: 2.0.0
endpointsharetweet
var express = require("@runkit/runkit/express-endpoint/1.0.0"); var app = express(exports); var bodyParser = require("body-parser") var bcrypt = require('bcryptjs') app.use(bodyParser.urlencoded({extends:true})) app.use(bodyParser.json()) app.get('/', async (req,res)=> { var query = req.query; var {text, verifyText} = query console.dir('Req query', query) if(text){ var hashText = bcrypt.hashSync(text) } if(text && verifyText){ var verify = await bcrypt.compare(text, verifyText) } res.send({...query, hashText, verifyText, verify}) }) app.post("/", (req, res) => { console.log(`Req Body:`) console.log(req.body) res.send(req.body) }) //app.get("/:name", (req, res) => res.send(`hey ${req.params.name}`))
Loading…

no comments

    sign in to comment