forked from EA11FYP/server
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.js
29 lines (25 loc) · 821 Bytes
/
index.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
const express = require('express');
const app = express();
const bodyParser = require('body-parser');
const mongoose = require('mongoose');
const keys = require('./config/keys');
app.use(bodyParser.json());
app.use((req, res , next) => {
res.setHeader('Access-Control-Allow-Origin', '*');
res.setHeader('Access-Control-Allow-Headers', 'Origin, X-Requested-With, Content-Type, Accept, Authorization');
res.setHeader('Access-Control-Allow-Methods', 'GET, POST, PATCH, DELETE');
next();
});
app.get("/", (req,res) => {
res.send("message: Connected sucessfully");
})
const PORT = process.env.PORT || 5000;
app.listen(PORT);
// mongoose.connect(keys.mongoURI)
// .then(() => {
// app.listen(PORT);
// console.log("Server Started");
// })
// .catch(err => {
// console.log(err);
// });