-
Notifications
You must be signed in to change notification settings - Fork 0
/
app.js
38 lines (32 loc) · 1.07 KB
/
app.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
import express from 'express';
import { createServer } from 'http';
import serve_favicon from 'serve-favicon';
import mustacheExpress from 'mustache-express';
import 'dotenv/config'
import cors from "cors";
import routes from './routes/routes.js';
const app = express();
const http = createServer(app);
const mustache = mustacheExpress();
mustache.cache = null;
http.setTimeout(10000, ()=> {
console.log("app.js: HTTP server timed out");
})
app.use(cors({
'origin': ['https://postcard.gaborcsapo.com', 'http://postcard.gaborcsapo.com', "http://localhost:8080"],
}))
app.use(express.json());
app.engine('mustache', mustache);
app.set('view engine', 'mustache')
app.set('views', 'public/views');
app.use(express.static('dist'));
app.use('/', routes.home);
app.use('/trip', routes.trip);
app.use('/editor', routes.editor);
app.use('/data', routes.data);
app.use(serve_favicon('dist/resources/img/favicon.png'));
// const PORT = parseInt(process.env.PORT) || 8080;
// http.listen(PORT, () => {app.use(express.json());
// console.log(`HTTP listening on port ${PORT}.`);
// })
export { app }