Last active
September 12, 2017 21:40
-
-
Save jcenturion/6ca70a7bb74748d3e3083de5f8a147ae 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
const yaml = require('js-yaml'); | |
module.exports = (options, cb) => { | |
return cb(null, (ctx, req, res) => { | |
if (req.method !== 'GET') { | |
res.writeHead(405); | |
return res.end(); | |
} | |
res.writeHead(200, { 'Content-Type': 'application/json' }); | |
res.end(JSON.stringify(yaml.load(options.script))); | |
}); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment