Update docs

This commit is contained in:
Brandon Keepers 2017-08-01 22:42:23 -05:00
parent fa6136cdcd
commit ce9d87f626
No known key found for this signature in database
GPG Key ID: F9533396D5FACBF6
1 changed files with 3 additions and 6 deletions

View File

@ -92,20 +92,17 @@ Listening on http://localhost:3000
## HTTP Routes
`robot.route` is an app that will serve HTTP requests.
Calling `robot.route('/my-plugin')` will return an [express](http://expressjs.com/) router that you can use to expose HTTP endpoints from your plugin.
```js
const express = require('express');
module.exports = robot => {
// Get an express router to expose new HTTP endpoints
const app = robot.route('/my-plugin');
// Use any middleware
app.use(express.static(__dirname + '/public'));
app.use(require('express').static(__dirname + '/public'));
//
// Add a new route
app.get('/hello-world', (req, res) => {
res.end('Hello World');
});