forked from alibaba/funcraft
-
Notifications
You must be signed in to change notification settings - Fork 0
/
fun-local-start.js
35 lines (28 loc) · 1.59 KB
/
fun-local-start.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#!/usr/bin/env node
/* eslint-disable quotes */
'use strict';
const program = require('commander');
program
.name('fun local start')
.description(`
Allows you to run the Function Compute applicatoin locally for quick development & testing.
It will start a http server locally to receive requests for http triggers and apis.
It scans all functions in template.yml. If the resource type is HTTP, it will be registered to this http server, which can be triggered by the browser or any http tools.
For other types of functions, they will be registered as apis, which can be called by sdk in each language or directly via api.
Function Compute will look up the code by CodeUri in template.yml.
For interpreted languages, such as node, python, php, the modified code will take effect immediately without restarting the http server.
For compiled languages such as java, we recommend you set CodeUri to the compiled or packaged location.
Once compiled or packaged result changed, the modified code will take effect immediately without restarting the http server.`
)
.usage('[options]')
.option('-d, --debug-port <port>', 'specify the sandbox container starting in debug' +
' mode, and exposing this port on localhost')
.option('-c, --config <ide/debugger>', 'output ide debug configuration. Options:\'vscode\'')
.parse(process.argv);
if (program.args.length) {
console.error();
console.error(" error: unexpected argument `%s'", program.args[0]);
program.help();
}
require('../lib/commands/local/start')(program)
.catch(require('../lib/exception-handler'));