-
Notifications
You must be signed in to change notification settings - Fork 2
/
start.js
57 lines (42 loc) · 1.36 KB
/
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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
// execute this file to start all the servers
const { spawn } = require('child_process');
const path = require('path');
async function frontend() {
const frontend = spawn('npm', ['start'], { cwd: path.join(__dirname, 'frontend'), shell: true });
frontend.stdout.on('data', (data) => {
console.log(`frontend: ${data}`);
});
frontend.stderr.on('data', (data) => {
console.error(`frontend: ${data}`);
});
frontend.on('close', (code) => {
console.log(`frontend exited with code ${code}`);
});
}
async function backend() {
const backend = spawn('npm', ['run','dev'], { cwd: path.join(__dirname, 'backend/main'), shell: true});
backend.stdout.on('data', (data) => {
console.log(`backend: ${data}`);
});
backend.stderr.on('data', (data) => {
console.error(`backend: ${data}`);
});
backend.on('close', (code) => {
console.log(`backend exited with code ${code}`);
});
}
async function ws() {
const ws = spawn('nodemon', ['index.js'], { cwd: path.join(__dirname, 'backend/ws') , shell: true});
ws.stdout.on('data', (data) => {
console.log(`ws: ${data}`);
});
ws.stderr.on('data', (data) => {
console.error(`ws: ${data}`);
});
ws.on('close', (code) => {
console.log(`ws exited with code ${code}`);
});
}
frontend();
backend();
ws();