-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathindex.js
29 lines (23 loc) · 808 Bytes
/
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
const express = require("express");
const exphbs = require("express-handlebars");
const bodyParser = require("body-parser");
const path = require("path");
const mysql = require("mysql");
require("dotenv").config();
const app = express();
const port = process.env.port || 3000;
const static_path = path.join(__dirname, "../public");
app.use(bodyParser.urlencoded({ extended: false }));
app.use(bodyParser.json());
//static files
app.use(express.static(static_path));
//templating engine
const handlebars = exphbs.create({ extname: "hbs" });
app.engine('hbs', handlebars.engine);
app.set('view engine', 'hbs');
app.use(express.static(__dirname + '/public'));
const routes = require('./server/routes/user');
app.use('/', routes);
app.listen(port, () => {
console.log(`Listening from port ${port}`);
})