-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsetup.js
35 lines (28 loc) · 883 Bytes
/
setup.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
const { app } = require('electron');
const express = require('express');
const path = require('path');
const webRoutes = require('./routes/WebRoute');
const { createWindow } = require('./app/Window');
const expressApp = express();
const port = 3000;
expressApp.set('view engine', 'ejs');
expressApp.set('views', path.join(__dirname, 'views'));
expressApp.use(express.static(path.join(__dirname, 'public')));
expressApp.use(express.urlencoded({ extended: true }));
expressApp.use('/', webRoutes);
expressApp.listen(port, () => {
console.log(`Express server running on http://localhost:${port}`);
});
app.whenReady().then(() => {
createWindow(port);
app.on('activate', () => {
if (BrowserWindow.getAllWindows().length === 0) {
createWindow(port);
}
});
});
app.on('window-all-closed', () => {
if (process.platform !== 'darwin') {
app.quit();
}
});