-
Notifications
You must be signed in to change notification settings - Fork 1
/
app.js
36 lines (28 loc) · 877 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
32
33
34
35
36
'use strict';
require('dotenv').load();
const express = require('express');
const http = require('http');
const bodyParser = require('body-parser');
const handlebars = require('express-handlebars');
// app
const app = express();
const server = http.createServer(app);
const port = process.env.PORT || 5000;
const host = process.env.HOST || 'localhost';
// view engine
app.engine('handlebars', handlebars({ defaultLayout: 'main' }));
app.set('view engine', 'handlebars');
// body parser
app.use(bodyParser.json());
app.use(bodyParser.urlencoded({ extended: false }));
// set base root
app.use(express.static(`${__dirname}/public`));
// connect db
//require('./dbconn')();
// connect routes
require('./api/shelters')(app);
require('./api/routes')(app);
require('./api/email')(app);
// start server
server.listen(port, host);
console.log(`Magic is happening on ${port}`);