-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathapp.js
54 lines (37 loc) · 1.23 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
48
49
50
51
52
const dotenv = require("dotenv");
const mongoose = require('mongoose');
const express = require('express');
const app = express();
const cors = require('cors');
dotenv.config({ path: './config.env' });
require('./db/conn');
// const User = require('./model/userSchema');
app.use(express.json());
app.use(cors({
origin: 'https://mern01-frontend.netlify.app', // Replace with your frontend domain
credentials: true // Allow credentials (if required)
}));
// we link the router files to make our route easy
app.use(require('./router/auth'));
const PORT = process.env.PORT || 5000;
// Middelware
// const middleware = (req,res, next) => {
// console.log(`Hello my Middleware`);
// next();
// }
// app.get('/about', (req, res) => {
// console.log(`Hello my About`);
// res.send(`Hello About world from the server`);
// });
// app.get('/contact', (req, res) => {
// res.send(`Hello Contact world from the server`);
// });
// app.get('/signin', (req, res) => {
// res.send(`Hello Login world from the server`);
// });
// app.get('/signup', (req, res) => {
// res.send(`Hello Registration world from the server`);
// });
app.listen(PORT, () => {
console.log(`server is running at port no ${PORT}`);
})