Would you like to clone this notebook?

When you clone a notebook you are able to make changes without affecting the original notebook.


Express-Endpoint Demo

node v4.9.1
version: 2.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 ${req.params.name}!`) }) app.post("/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.


  • posted 6 years ago by wrg99
  • posted 6 years ago by abol
    👍 Omar aljabli
  • posted 5 years ago by imhomos
  • posted 5 years ago by 59c940eec9e046001256f18e
    Is `tonicExpress` a legacy name? In other words, if you had written this Notebook today, would you have named that variable `runkitExpress` instead?
  • posted 5 years ago by lookdeepu
    Thank you.
  • posted 4 years ago by pavi2410
    I'm unable to get this work https://runkit.com/pavi2410/node-js-test
  • posted 4 years ago by ngocloi
  • posted 4 years ago by ngocloi
  • posted 4 years ago by 5bdf16a8044148001354017b
  • posted 4 years ago by swn
  • posted 4 years ago by swn
    pos time zone
  • posted 3 years ago by shliilh
  • posted 10 months ago by tuanggo
  • posted 4 months ago by us1
  • posted 2 months ago by mikypearl
  • posted 23 days ago by shahidaleem
    Very good and very good

sign in to comment