-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.js
33 lines (29 loc) · 1 KB
/
index.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
const http = require('http');
const dotenv = require('dotenv');
const fs = require('fs');
const path = require('path');
const helmet = require('helmet');
const express = require('express');
const packageJson = require('./package.json');
const app = express();
const BlogSystem = require('./src/entities/blogSystem/core');
const blogSystem = new BlogSystem();
app.set('view engine', 'ejs');
app.set('views', path.join(__dirname, './src/templates'))
app.use(express.json());
app.use(express.urlencoded({
extended: true
}));
app.use(helmet()); // Sending various http headers
app.use('/public', express.static('./src/public'));
dotenv.config();
//Routing Web
require('./src/routes/routes')(app);
const port = process.env.PORT || 8080;
let server = http.createServer(app);
console.log();
console.log(`Package Name: ${packageJson.name} v${packageJson.version}`);
console.log(`App mode: ${app.get('env')}`);
console.log('');
// Run server
server.listen(port, () => console.log(`Server corriendo en el puerto ${port}...`));