-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathapp.js
31 lines (25 loc) · 958 Bytes
/
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
const express = require("express");
const bodyParser = require('body-parser');
const compress = require('compression');
const articlesRoute = require('./server/articles');
const formListRoute = require('./server/formList');
const contactUsRoute = require('./server/contactUs');
const asciiRoute = require('./server/ascii');
const port = process.env.PORT || 3000;
const app = express();
app.use(compress());
app.use(bodyParser.json());
app.use('/', express.static(`${__dirname}/public`));
app.disable('x-powered-by');
app.post('/contact-us', contactUsRoute);
app.get('/ascii-content', asciiRoute);
app.get('/form-lists', formListRoute);
app.get('/articles', articlesRoute);
app.get('*', (req, res)=> res.redirect('../'));
app.listen(port, ()=> {
console.log(`Js-Republic website listening on port ${port}`);
if (process.env.NODE_ENV === "production") {
console.log('ENVIRONEMENT VARIABLES :');
console.log(process.env);
}
});