Would you like to clone this notebook?

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

Cancel

Endpoint with Express

node v4.9.1
version: 1.0.0
endpointsharetweet
var express = require("express"); function tonicExpress(anExport) { var mount = express(); var app = express(); // "mount" is our root app, and it mounts "app" at your notebook path // which is available in the TONIC_MOUNT_PATH environment variable mount.use(process.env.TONIC_MOUNT_PATH || "", app); if (anExport) { anExport.tonicEndpoint = mount; } // overwrite .listen since it is not needed app.listen = function(){} // return the express instance for use by the caller return app; } module.exports = tonicExpress
Use this helper to quickly return a Tonic Endpoint compatible express app, in place of calling express directly. Here's an example use: https://tonicdev.com/tonic/express-endpoint-demo.
Loading…

no comments

    sign in to comment