-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathserver.js
More file actions
26 lines (19 loc) · 725 Bytes
/
server.js
File metadata and controls
26 lines (19 loc) · 725 Bytes
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
require('dotenv').config();
const express = require('express');
const connectDB = require('./config/mongodb');
const firebase = require('./config/firebase');
const cors = require('cors');
// Connect to MongoDB
connectDB();
const app = express();
// Init Middleware
app.use(express.json({ extended: false }));
app.use(cors({ origin: '*' }));
// Serve static files from the 'test' directory
app.use(express.static('public'));
// Define Routes
// app.get('/', (req, res) => res.sendFile(__dirname + '/test/index.html'));
app.use('/api', require('./routes/auth'));
app.use('/v2/api', require('./routes/authV2'));
const PORT = process.env.PORT || 5000;
app.listen(PORT, () => console.log(`Server started on port ${PORT}`));