- Create config.json to the ./etc dir on sheme:
{
"serverPort": "8080",
"db": {
"username": "username_db",
"pass": "pass_bd",
"host": "host_db",
"port": "port_db",
"name": "name_db"
}
}
- run
yarn
to instal dependencies
- run
yarn build
to building application files
- run
yarn start
to start application
Update app.js:
- Uncomment
import https from 'https';
import fs from 'fs';
https.createServer(options, app).listen(serverPort, function() {
console.log(`Express server listening on port ${serverPort}`);
});
const options = {
key: fs.readFileSync(path.join(__dirname, './path/to/private.key', 'private.key')),
cert: fs.readFileSync(path.join(__dirname, './path/to/certificate.srt', 'certificate.srt')),
};
- To comment
// import http from 'http';
// http.createServer(app).listen(serverPort, function() {
// console.log(`Express server listening on port ${serverPort}`);
// });
- Create SSL serts in ./path/to/private.key and './path/to/certificate.srt'