2018-12-29 22:07:50 +00:00
|
|
|
import express from 'express'
|
|
|
|
import fs from 'fs'
|
|
|
|
import {serverRender} from './utils/serverRender'
|
2019-01-21 18:21:51 +00:00
|
|
|
import csshook from 'css-modules-require-hook/preset'
|
2018-12-29 22:07:50 +00:00
|
|
|
const port = process.env.PORT || 3000;
|
|
|
|
const app = express()
|
2017-07-15 14:52:09 +00:00
|
|
|
|
2018-12-29 22:07:50 +00:00
|
|
|
// const filename = './src/utils/data.json';
|
|
|
|
// const dataStub = {"posts": [], "other": []};
|
|
|
|
// fs.writeFileSync(filename, JSON.stringify(dataStub));
|
2017-11-01 17:31:50 +00:00
|
|
|
|
2018-12-29 22:07:50 +00:00
|
|
|
// require('./utils/scanner')();
|
2017-07-15 14:52:09 +00:00
|
|
|
|
2019-01-21 18:21:51 +00:00
|
|
|
app.use('/static', express.static('public/static'))
|
|
|
|
|
2017-11-09 20:51:04 +00:00
|
|
|
app.get("*", serverRender);
|
2017-04-09 19:09:27 +00:00
|
|
|
|
2017-07-15 14:52:09 +00:00
|
|
|
app.listen(port, function(error) {
|
|
|
|
if (error) {
|
2017-11-09 20:51:04 +00:00
|
|
|
console.error(error);
|
2017-07-15 14:52:09 +00:00
|
|
|
} else {
|
2017-11-09 20:51:04 +00:00
|
|
|
console.info("[Server] Listening on port %s", port);
|
2017-04-09 19:09:27 +00:00
|
|
|
}
|
2017-07-15 14:52:09 +00:00
|
|
|
})
|