-
Notifications
You must be signed in to change notification settings - Fork 0
/
app.js
47 lines (32 loc) · 1.4 KB
/
app.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
require('dotenv').config();
const express = require('express');
const mongoose=require('mongoose')
const cookieParser = require('cookie-parser');
const app=express();
app.use(cookieParser());
const authMiddleware = require('./middleware/authMiddleware');
app.use(authMiddleware);
const Reservation=require('./models/reservation')
const Lawyer=require('./models/lawyer')
const City=require('./models/city')
const Bar=require('./models/bar')
const dbURI = `mongodb+srv://busetolunay2000:${process.env.PASSWORD}@cluster0.gnvzhlf.mongodb.net/`; // Replace with your actual MongoDB connection string
mongoose.connect(dbURI, { useNewUrlParser: true, useUnifiedTopology: true} )
.then((result)=> app.listen(3000))
.catch((err)=> console.log(err)) ;
app.use(express.json());
app.set('view engine', 'ejs');
const authRoutes = require('./routes/auth');
const citiesRoutes = require('./routes/cities');
const lawyersRoutes = require('./routes/lawyers');
const profileRoutes = require('./routes/profile');
const requestsRoutes = require('./routes/requests');
//const locationRoutes = require('./routes/location');
app.use('/auth' , authRoutes);
app.use( '/cities' , citiesRoutes);
app.use('/lawyers',lawyersRoutes);
app.use( '/profile',profileRoutes);
app.use( '/requests', requestsRoutes);
app.use((req,res)=>{
res.sendFile('./views/404.ejs',{root: __dirname})
});