forked from DiasJulia/Tramp
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathserver.js
More file actions
33 lines (25 loc) · 888 Bytes
/
Copy pathserver.js
File metadata and controls
33 lines (25 loc) · 888 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
// server.js
const MongoClient = require ('mongodb');
const uri = "mongodb+srv://admin:admin123@cluster-trampme-dqevg.gcp.mongodb.net/test?retryWrites=true&w=majority";
MongoClient.connect(uri, (err, client) =>{
if(err) return console.log(err);
db = client.db('TrampMe');
app.listen(port, () =>{
console.log("O server tá ouvindo a porta 3000");
});
})
const express = require('express');
const app = express();
const port = 3000;
const path = require('path');
const bodyParser = require('body-parser');
const CoinRouter = require('./routes/CoinRouter');
app.use(bodyParser.urlencoded({ extended: true }));
app.use(bodyParser.json());
app.use(express.static('views'));
app.use(express.static('public'));
app.set('view engine', 'ejs');
app.use(bodyParser.urlencoded({ extended: true }));
app.use(bodyParser.json());
app.use('/', CoinRouter);
app.use("/post", CoinRouter);