Last active
September 17, 2019 10:06
-
-
Save matthewhudson/a8f53284feee997dea8d9cf1573f894b to your computer and use it in GitHub Desktop.
OMG & @webpipe/server interface idea
This file contains 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
const WebPipeServer = require('@webpipe/server'); | |
// Automatically exposes service definition | |
// Automatically exposes `/health` checkpoint | |
module.exports = new WebPipeServer() | |
// .enableDevelopmentMode() // This line enables dev mode | |
// .enableMonitorMode() // This line enables monitor mode | |
.configureEnvironment(environment => { | |
environment.setVariable() | |
// environment.setPort() | |
// environment.setHost() | |
}) | |
.configurePolicies(policy => { | |
// Configure policies by using the `policy` object | |
policy.outboundHttp.allowGet( | |
' | |
) | |
}) | |
.setHandlerName('handler') | |
.setHandlerFile(`${__dirname}/handler.js`) | |
.run() |
This file contains 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
const OMG = require('@omg/service'); | |
// Automatically exposes service definition | |
// Automatically exposes `/health` checkpoint | |
module.exports = new OMG() | |
// .enableDevelopmentMode() // This line enables dev mode | |
// .enableMonitorMode() // This line enables monitor mode | |
.configureEnvironment(environment => { | |
environment.setVariable() | |
// environment.setPort() | |
// environment.setHost() | |
}) | |
.configurePolicies(policy => { | |
// OMG should set up internally based on routes? | |
// Configure policies by using the `policy` object | |
policy.outboundHttp.allowGet( | |
'' | |
) | |
}) | |
.configureInput(input => { | |
// Use JOI for | |
input.setName('x').setType('number').setDescription('...') | |
input.setName('y').setType('number').setDescription('...') | |
}) | |
.setHandlerName('handler') // Cruft, this should be the default | |
.setHandlerFile(`${__dirname}/index.js`) // Cruft, this should be the default | |
.run() | |
/** | |
* Interface assumes | |
* | |
*/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment