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 actual dependencies | |
| const dependency1 = require('dependency1'), | |
| dependency2 = require('dependency2'); | |
| const myExport = require('./my-export.js')(dependency1, dependency2); | |
| /* Do something */ |
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 {behavior1} from "./behavior.js" | |
| var app = express(); | |
| app.use(function (req, res, next) { | |
| behavior1() | |
| .then(res.send.bind(res)) | |
| .catch(next); | |
| }); |
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 koa from "koa" | |
| import {behavior1} from "./behavior.js" | |
| var app = koa(); | |
| app.use(function* (next) { | |
| this.body = yield behavior1(); | |
| return yield next; | |
| }); |
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
| export class ApplicationController { | |
| constructor() { | |
| this.foo = 'bar'; | |
| } | |
| } |
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
| //Tie Routes to Promise States | |
| var middleware = require('./middleware.js'); | |
| app.get('example/uri', function(req, res, next) { | |
| middleware(req, res) | |
| .then(function() { next(); }) | |
| .catch(res.json) | |
| .done(); | |
| }); |