forked from freeCodeCamp/freeCodeCamp
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdevelopment-start.js
More file actions
43 lines (36 loc) · 1.17 KB
/
development-start.js
File metadata and controls
43 lines (36 loc) · 1.17 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
36
37
38
39
40
41
42
43
const path = require('path');
require('dotenv').config({ path: path.resolve(__dirname, '../../.env') });
const createDebugger = require('debug');
const nodemon = require('nodemon');
const SmeeClient = require('smee-client');
const log = createDebugger('fcc:start:development');
if (process.env.WEBHOOK_PROXY_URL) {
const paypalPayloadHandler = new SmeeClient({
source: process.env.WEBHOOK_PROXY_URL,
target: process.env.API_LOCATION + '/hooks/update-paypal',
logger: { info: log, error: log }
});
const paypalevents = paypalPayloadHandler.start();
process.on('exit', () => {
log('Stopping webhook proxy client.');
paypalevents.close(() => {
log('Webhook proxy client is stopped.');
});
});
} else {
log('Webhook client is not configured.');
log('This can be ignored when not working with webhooks locally.');
}
nodemon({
ext: 'js json',
// --silent squashes an ELIFECYCLE error when the server exits
exec: 'npm run --silent babel-dev-server',
watch: path.resolve(__dirname, './server'),
spawn: true,
env: {
DEBUG: 'fcc*'
}
});
nodemon.on('restart', function nodemonRestart(files) {
log('App restarted due to: ', files);
});