mirror of
https://gitee.com/mafgwo/stackedit
synced 2024-11-16 11:42:23 +08:00
c8987a8e84
Upgraded Mermaid to v8.9. Removed StackEdit v4 support.
28 lines
597 B
JavaScript
28 lines
597 B
JavaScript
const env = require('./config/prod.env');
|
|
|
|
Object.keys(env).forEach((key) => {
|
|
if (!process.env[key]) {
|
|
process.env[key] = JSON.parse(env[key]);
|
|
}
|
|
});
|
|
|
|
const http = require('http');
|
|
const express = require('express');
|
|
|
|
const app = express();
|
|
|
|
require('./server')(app);
|
|
|
|
const port = parseInt(process.env.PORT || 8080, 10);
|
|
const httpServer = http.createServer(app);
|
|
httpServer.listen(port, null, () => {
|
|
console.log(`HTTP server started: http://localhost:${port}`);
|
|
});
|
|
|
|
// Handle graceful shutdown
|
|
process.on('SIGTERM', () => {
|
|
httpServer.close(() => {
|
|
process.exit(0);
|
|
});
|
|
});
|