Express-Endpoint Demo

node v4.9.1
version: 1.0.0
var tonicExpress = require("@runkit/runkit/express-endpoint/1.0.0") // Just provide the exports object to the tonicExpress helper var app = tonicExpress(module.exports) var bodyParser = require('body-parser'); app.use(bodyParser.urlencoded({ extended: false })); app.get("/", (req, res) => res.send("Hey!")) app.get("/:name", (req, res) => { res.send(`Hello ${}!`) })"/echo-form", (req, res) => { var formData = Object.keys(req.body).map( k => `${k}: ${req.body[k]}` ) res.type("text/plain") res.send(formData.join("\n")) })
Once you create your Express app with the tonicExpress helper, it works like any other Express app. You can use middleware, declare routes, etc.

no comments

    sign in to comment