-
Notifications
You must be signed in to change notification settings - Fork 2
/
server.js
40 lines (33 loc) · 1.09 KB
/
server.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
const path = require("path");
const express = require("express");
const routes = require("./controllers");
const db = require("./models");
// const admin = require("firebase-admin");
// const serviceAccount = require("./config/service-account-file.json");
// admin.initializeApp({
// credential: admin.credential.cert(serviceAccount),
// databaseURL: "https://simfba-interface.firebaseio.com",
// });
const PORT = process.env.PORT || 3001;
const app = express();
// const admin = require('firebase-admin');
// const firebase = admin.initializeApp({
// credential: admin.credential.applicationDefault(),
// databaseURL: 'https://simfba-interface.firebaseio.com'
// });
// Define middleware
app.use(express.urlencoded({ extended: true }));
app.use(express.static("client/simfba-interface/public"));
app.use(express.json());
app.use(routes);
app.get("/:reqStr", function (req, res) {
res.sendFile(
path.resolve(
__dirname,
"client/simfba-interface/public/" + req.params.reqStr
)
);
});
app.listen(PORT, () => {
console.log(`🌎 ==> API Server now listening on PORT ${PORT}!`);
});