forked from this-is-varun/MernAuth
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapp.js
More file actions
52 lines (34 loc) · 1.15 KB
/
app.js
File metadata and controls
52 lines (34 loc) · 1.15 KB
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
const dotenv = require("dotenv");
const mongoose = require('mongoose');
const express = require('express');
const cookieParser = require('cookie-parser');
const app = express();
app.use(cookieParser());
dotenv.config({ path: './config.env' });
require('./db/conn');
// const User = require('./model/userSchema');
app.use(express.json());
// we link the router files to make our route easy
app.use(require('./router/auth'));
const PORT = process.env.PORT || 5000;
//// I just comment out the below about section
// app.get('/about', (req, res) => {
// console.log(`Hello my About`);
// res.send(`Hello About world from the server`);
// });
// app.get('/contact', (req, res) => {
// // res.cookie("Test", 'thapa');
// 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`);
});
if(process.env.NODE_ENV=="production"){
app.use(express.static('client/build'));
}
app.listen(PORT, () => {
console.log(`server is runnig at port no ${PORT}`);
})