Would you like to clone this notebook?

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

Cancel

My First Playground

node v8.17.0
version: 1.0.0
endpointsharetweet
This is a playground to test JavaScript. It runs a completely standard copy of Node.js on a virtual server created just for you. Every one of npm’s 300,000+ packages are pre-installed, so try it out:
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 })); var CognitoStrategy = require('passport-cognito') require("passport").use(new CognitoStrategy({ userPoolId: 'ap-northeast-1_eSjqLfqKc', clientId: 'vtvg02tr21zmxvspyvawtv09b', region: 'ap-northeast-1' }, function(accessToken, idToken, refreshToken, user, cb) { process.nextTick(function() { cb(null, user); }); } )); 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")) })
Loading…

no comments

    sign in to comment