-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathindex.js
56 lines (43 loc) · 1.72 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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
const path = require('path');
const express = require('express');
const bodyParser = require('body-parser');
const jwt = require('jsonwebtoken');
const exjwt = require('express-jwt');
const port = process.env.PORT || 8000;
const cors = require('cors');
const logger = require('morgan');
const knex = require('./db/knex');
const index = require('./routes/indexRoutes');
const auth = require('./routes/authRoutes');
const challenges = require('./routes/challengesRoutes');
const features = require('./routes/featuresRoutes');
const user_input = require('./routes/userInputRoutes');
const user_rate = require('./routes/userRateRoutes');
const active_challenges = require('./routes/activeChallengesRoutes');
// The Cloud Functions for Firebase SDK to create Cloud Functions and setup triggers.
const functions = require('firebase-functions');
// The Firebase Admin SDK to access the Firebase Realtime Database.
const admin = require('firebase-admin');
admin.initializeApp(functions.config().firebase);
var app = express();
app.set('views', path.join(__dirname, 'views'));
app.set('view engine', 'ejs');
app.use(logger('dev'));
app.use(cors());
app.use(bodyParser.json())
app.use(bodyParser.urlencoded({ extended: false }));
// app.use((req, res, next) => {
// res.setHeader('Access-Control-Allow-Origin', 'http://localhost:8080');
// res.setHeader('Access-Control-Allow-Headers', 'Content-type,Authorization');
// next();
// });
app.use('/', index);
app.use('/auth', auth);
app.use('/challenges', challenges);
app.use('/features', features);
app.use('/user_input', user_input);
app.use('/user_rate', user_rate);
app.use('/active_challenges', active_challenges);
app.listen(port, function() {
console.log("listening on port: ", port);
})