MCPcopy Index your code
hub / github.com/acode/cli / run

Method run

cli/commands/http.js:34–66  ·  view source on GitHub ↗
(params, callback)

Source from the content-addressed store, hash-verified

32 }
33
34 run(params, callback) {
35
36 let pkg;
37 let env;
38
39 try {
40 pkg = serviceConfig.get();
41 } catch(err) {
42 return callback(err);
43 }
44
45 try {
46 env = require(path.join(process.cwd(), 'env.json'));
47 } catch (e) {
48 console.error(e);
49 return callback(new Error('Invalid env.json in this directory'));
50 }
51
52 let build = pkg.stdlib.build;
53 let serviceName = pkg.stdlib.name;
54 let localRoute = pkg.stdlib.local.route;
55 let route = localRoute || serviceName;
56 let port = (params.flags.p || params.vflags.port || [])[0] || parseInt(pkg.stdlib.local.port) || 8170;
57
58 route = route.startsWith('/') ? route : '/' + route;
59
60 if (build !== 'legacy') {
61 child_process.fork(path.join(__dirname, '../local_http.js'), [`PORT=${port}`, `ROUTE=${route}`, `NAME=${serviceName}`]);
62 } else {
63 parser.check(err => parser.createServer(pkg, port, !!err));
64 }
65
66 }
67
68}
69

Callers

nothing calls this directly

Calls 1

getMethod · 0.80

Tested by

no test coverage detected