-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathserver.js
More file actions
39 lines (29 loc) · 964 Bytes
/
Copy pathserver.js
File metadata and controls
39 lines (29 loc) · 964 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
27
28
29
30
31
32
33
34
35
36
37
38
//module imports
const express = require('express');
const cors = require('cors');
const bodyparser = require('body-parser');
// const path = require('path');
const app = express();
app.use(express.static('public'))
// const uri = "mongodb+srv://abigod:bubbles@cluster0.zetfo.mongodb.net/edfusion?retryWrites=true&w=majority";
// MongoClient.connect(uri)
// .then((mongo) => {
// console.log('Connected to database');
// const collection = mongo.db("edfusion").collection("classrooms");
// const changeStream = collection.watch();
// changeStream.on('change', function(change) {
// console.log(change);
// });
// })
// .catch(function (err) {console.log(err)})
//port
const PORT = process.env.PORT || 8080;
//middlewares
app.use(cors());
app.use(bodyparser.json());
//routes
const route_api = require('./routes/api');
app.use('/api', route_api);
app.listen(PORT, () => {
console.log('Server started at port: '+ PORT);
});