before(function(){ notesRouter.get('/notes', (req, res) => {}); notesRouter.post('/notes', (req, res) => {}); notesRouter.put('/notes', (req, res) => {}); notesRouter.patch('/notes', (req, res) => {}); notesRouter.delete('/notes', (req, res) => {}); });
var src = pass.pipe(es.through(function (f) { if (!buffer) { return; } buffer.push(f); if (f.relative !== 'package.json') { return; } var json = JSON.parse(f.contents.toString('utf8')); opts = util._extend({}, opts); // We need to extract the application's name and version // in order to feed it to the various platforms build // process. opts.productName = json.name; opts.productVersion = json.version; var platform = require('./' + opts.platform); var sources = es.merge(es.readArray(buffer), pass) .pipe(moveApp(platform, opts)); var atomshell = downloadAtomshell(opts) .pipe(platform.patch(opts)); es.merge(sources, atomshell).pipe(result); buffer = null; }));
return function (moduleName) { var module = func.apply(this, arguments); if (module && !module._scalex_patched && path.extname(moduleName) !== '.js') { var wrapper_path = path.join(wrapper_dir, moduleName + '.js'); if (existsSync(wrapper_path)) { try { var module_wrapper = require(wrapper_path); LOG.debug("Patching module: %s", moduleName); module_wrapper.patch(module); module._scalex_patched = true; } catch(e) { LOG.error("Failed to patch: %s, error: %s", moduleName, e.stack || e); } } } return module; };
function patch(path, cb) { router.patch(path, cb); }
practiceRouter.get('/cat'); // practice with POST using individualized post written in the response practiceRouter.post('/tiger', '220', 'text/plain', 'anything expect for chunk'); // practice with POST using the sent data as what is written in the response practiceRouter.post('/duck', '200', 'text/plain', 'chunk'); // practice and testing DELETE functionality practiceRouter.delete('/delete', (req, res) => { res.writeHead(200, { 'Content-Type': 'text/plain' }); res.write('so much delete'); res.end(); }); // practice and testing PUT functionality practiceRouter.put('/put', (req, res) => { req.on('data', (chunk) => { res.writeHead(200, { 'Content-Type': 'text/plain' }); res.write(chunk); res.end(); }); }); // practice and testing PATCH functionality practiceRouter.patch('/patch', (req, res) => { res.writeHead(200, { 'Content-Type': 'text/plain' }); res.write('Patch up for what'); res.end(); });