-
Notifications
You must be signed in to change notification settings - Fork 0
/
server.js
68 lines (40 loc) · 1.25 KB
/
server.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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
const dotenv = require("dotenv").config();
const express = require("express");
const colors = require("colors");
const cors = require("cors");
const req = require("express/lib/request");
const res = require("express/lib/response");
const mongoose = require("mongoose");
const dbOperation = require("./model/mssqlOperations");
const Employee = require("./model/Employee");
const app = express();
const PORT = process.env.SERVER_PORT;
// MICROSOFT SQL CONNECTION
// STARTS HERE
// let Pam = new Employee(800, 'New', 'CPG/Retail', 1, 0, 1, '2017-07-01', '1', '2017-07-02');
// dbOperation.createEmployees(Pam);
// dbOperation.getEmployees().then((res) => {
// console.log(res.recordset);
// });
// MICROSOFT SQL CONNECTION
// ENDS HERE
// Mongo DB Connection
// STARTS HERE
// const DB = process.env.DATABASE;
// mongoose
// .connect(DB)
// .then(() => {
// console.log(`MongoDB connected`);
// })
// .catch((err) => console.log(err));
// Mongo DB Connection
// ENDS HERE
// MIDDLEWARES
app.use(cors());
app.use(express.json({ extended: false }));
// Linking router files to make our route easy
app.use(require("./router/routes"));
// LISTEN REQUEST
app.listen(PORT, function () {
console.log(`Server started on port ${PORT}`.red.bold);
});