-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathapp.js
61 lines (50 loc) · 1.63 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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
const express = require('express');
const app = express();
const session = require('express-session');
const passport = require('./config/passport');
const exphbs = require('express-handlebars');
const bodyParser = require('body-parser');
const db = require('./models');
//* ================================
//* Twilio - needs further build
//* ================================
// const Twilio = require('twilio');
// const accountSid = process.env.twilioSID;
// const authToken = process.env.twilioAuth;
// const client = new Twilio(accountSid, authToken);
// client.messages
// .create({
// body: 'Hello from GitJobs! Twilio integration FTW!',
// to: '+18042002897',
// from: '+19382018822'
// })
// .then((message) => console.log(message.sid));
// Body Parser
app.use(bodyParser.json());
app.use(bodyParser.urlencoded({ extended: false }));
app.use(
session({
resave: false,
saveUninitialized: true,
secret: 'SECRET'
})
);
app.use(passport.initialize());
app.use(passport.session());
// static css
app.use(express.static('public'));
app.engine('handlebars', exphbs({ defaultLayout: 'main' }));
app.set('view engine', 'handlebars');
//* =============================================================
//* Routes
//* =============================================================
require('./routes/contacts-api-routes')(app);
require('./routes/applications-api-routes')(app);
require('./routes/companies-api-routes')(app);
require('./routes/html-routes')(app);
const PORT = process.env.PORT;
db.sequelize.sync({}).then(() => {
app.listen(PORT, () => {
console.log('App listening on port http://localhost:' + PORT);
});
});