Join us for office hours !

HTTP Routes

Calling robot.route('/my-app') will return an express router that you can use to expose HTTP endpoints from your app.

module.exports = robot => {
  // Get an express router to expose new HTTP endpoints
  const app = robot.route('/my-app');

  // Use any middleware
  app.use(require('express').static(__dirname + '/public'));

  // Add a new route
  app.get('/hello-world', (req, res) => {
    res.end('Hello World');
  });
};

Visit https://localhost:3000/my-app/hello-world to access the endpoint.

It is strongly encouraged to use the name of your package as the prefix so none of your routes or middleware conflict with other apps. For example, if probot/owners exposed an endpoint, the app would call robot.route('/owners') to prefix all endpoints with /owners.

See the express documentation for more information.

Find a mistake or want to help improve this documentation? Suggest changes on GitHub

Get occasional updates on new apps & features.

Star

with by @bkeepers

Code licensed ISC Docs licensed CC-BY-4.0