Last active
December 28, 2015 17:19
-
-
Save jurajpelikan/b7d65e09a32d0b8fc4f6 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import express from "express"; | |
| import yargs from "yargs"; | |
| const app = express(); | |
| const paths = { | |
| root: "/", | |
| descriptor: "/descriptor/", | |
| }; | |
| const getUrl = (name) => { | |
| if (paths[name]) { | |
| return yargs.argv.ngrok + paths[name]; | |
| } | |
| return yargs.argv.ngrok; | |
| }; | |
| app.get(paths.root, (req, res) => { | |
| res.send("<h1>Hey Ho Let's Go!</h1>"); | |
| }); | |
| app.get(paths.descriptor, (req, res) => { | |
| res.json({ | |
| key: "hipchat-connect-example-cloudo", | |
| name: "Tutorial", | |
| description: "A simple add-on showing cool hipchat connect api features.", | |
| vendor: { | |
| name: "Juraj Pelikan", | |
| url: "https://www.cloudo.co" | |
| }, | |
| links: { | |
| self: getUrl("descriptor") | |
| }, | |
| capabilities: { | |
| hipchatApiConsumer: { | |
| scopes: [ | |
| "send_notification", | |
| "view_room", | |
| ] | |
| } | |
| } | |
| }); | |
| }); | |
| app.listen(8000, () => { | |
| console.log(`Integration descriptor url: ${getUrl("descriptor")}`); | |
| }); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment