-
Notifications
You must be signed in to change notification settings - Fork 36
Expand file tree
/
Copy pathfunctions.js
More file actions
35 lines (29 loc) · 1.05 KB
/
functions.js
File metadata and controls
35 lines (29 loc) · 1.05 KB
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
const chalk = require('chalk');
const {
serveFunctions
} = require('netlify-cli/src/utils/serve-functions');
const settings = {
functions: "src/functions",
functionsPort: 5000
};
const {
NETLIFYDEVLOG,
NETLIFYDEVERR
} = {
NETLIFYDEV: `${chalk.greenBright('◈')} ${chalk.rgb(40, 180, 170)('Netlify Dev')} ${chalk.greenBright('◈')}`,
NETLIFYDEVLOG: `${chalk.greenBright('◈')}`,
NETLIFYDEVWARN: `${chalk.yellowBright('◈')}`,
NETLIFYDEVERR: `${chalk.redBright('◈')}`,
};
async function startFunctionsServer() {
const functionsServer = await serveFunctions(settings.functions);
functionsServer.listen(settings.functionsPort, function (err) {
if (err) {
console.error(`${NETLIFYDEVERR} Unable to start lambda server: `, err) // eslint-disable-line no-console
process.exit(1)
}
// add newline because this often appears alongside the client devserver's output
console.log(`\n${NETLIFYDEVLOG} Functions server is listening on ${settings.functionsPort}`) // eslint-disable-line no-console
});
}
startFunctionsServer();