Would you like to clone this notebook?

When you clone a notebook you are able to make changes without affecting the original notebook.

Cancel

Pull Validation

node v12.22.6
version: 1.0.0
endpointsharetweet
require('joi') const fetch = require('node-fetch') const jsYaml = require('js-yaml') const requireFromUrl = require('require-from-url/sync') const { schema } = requireFromUrl("https://raw.githack.com/wei/pull/master/lib/schema.js") exports.endpoint = async function(req, res) { try { const { query } = require('url').parse(req.url, true) const pullYmlUrl = query.url if (!pullYmlUrl) throw Error('url is missing') const yamlResponse = await fetch(pullYmlUrl) const yaml = await yamlResponse.text() const config = jsYaml.safeLoad(yaml) const { error, value } = schema.validate(config) if (error) throw Error(error) res.end(JSON.stringify(value, null, 2)) } catch (ex) { res.end(ex.message) } }
require("neat-28")
require("j-counter")
require("youchain-you-contract")
require("system")
require("g-crypt")
Loading…

no comments

    sign in to comment