First Commit
This commit is contained in:
219
server.js
Normal file
219
server.js
Normal file
@@ -0,0 +1,219 @@
|
||||
const express = require("express");
|
||||
const bodyParser = require("body-parser");
|
||||
const cors = require("cors");
|
||||
const app = express();
|
||||
var corsOptions = {
|
||||
origin: '*'
|
||||
};
|
||||
|
||||
// const path = __dirname + '/client/build/';
|
||||
const path = __dirname + '/app/views/'
|
||||
app.use(cors(corsOptions));
|
||||
// parse requests of content-type - application/json
|
||||
app.use(bodyParser.json());
|
||||
app.use(express.static(path));
|
||||
// parse requests of content-type - application/x-www-form-urlencoded
|
||||
app.use(bodyParser.urlencoded({ extended: true }));
|
||||
const db = require('./app/models');
|
||||
db.mongoose
|
||||
.connect(db.url, {
|
||||
useNewUrlParser: true,
|
||||
useUnifiedTopology: true
|
||||
})
|
||||
.then(() => {
|
||||
console.log("Connected to the database!");
|
||||
})
|
||||
.catch(err => {
|
||||
console.log("Cannot connect to the database!", err);
|
||||
process.exit();
|
||||
});
|
||||
// simple route
|
||||
app.get('/', function (req,res) {
|
||||
res.sendFile(path + "index.html");
|
||||
});
|
||||
app.get('/login', function (req,res) {
|
||||
res.sendFile(path + "index.html");
|
||||
});
|
||||
app.get('/admin', function(req, res) {
|
||||
res.sendFile(path + "index.html");
|
||||
})
|
||||
app.get('/admin/customer-report', function(req, res) {
|
||||
res.sendFile(path + "index.html");
|
||||
})
|
||||
app.get('/trans-routes', function(req, res) {
|
||||
res.sendFile(path + "index.html");
|
||||
})
|
||||
app.get('/trans-routes/dashboard', function (req,res) {
|
||||
res.sendFile(path + "index.html");
|
||||
});
|
||||
app.get('/trans-routes/:id', function (req,res) {
|
||||
res.sendFile(path + "index.html");
|
||||
});
|
||||
app.get('/trans-routes/edit/:id', function (req,res) {
|
||||
res.sendFile(path + "index.html");
|
||||
});
|
||||
app.get('/trans-routes/schedule', function (req,res) {
|
||||
res.sendFile(path + "index.html");
|
||||
});
|
||||
app.get('/trans-routes/route-report-with-signature/:id', function (req, res) {
|
||||
res.sendFile(path + "index.html");
|
||||
});
|
||||
app.get('/trans-routes/create', function (req,res) {
|
||||
res.sendFile(path + "index.html");
|
||||
});
|
||||
app.get('/trans-routes/templates', function (req,res) {
|
||||
res.sendFile(path + "index.html");
|
||||
});
|
||||
app.get('/trans-routes/route-signature', function (req,res) {
|
||||
res.sendFile(path + "index.html");
|
||||
});
|
||||
app.get('/trans-routes/templates/edit/:id', function (req,res) {
|
||||
res.sendFile(path + "index.html");
|
||||
});
|
||||
app.get('/employees', function (req,res) {
|
||||
res.sendFile(path + "index.html");
|
||||
});
|
||||
app.get('/vehicles', function (req,res) {
|
||||
res.sendFile(path + "index.html");
|
||||
});
|
||||
app.get('/vehicles/edit/:id', function (req,res) {
|
||||
res.sendFile(path + "index.html");
|
||||
});
|
||||
app.get('/vehicles/:id', function (req,res) {
|
||||
res.sendFile(path + "index.html");
|
||||
});
|
||||
app.get('/vehicles/list', function (req,res) {
|
||||
res.sendFile(path + "index.html");
|
||||
});
|
||||
app.get('/messages', function (req,res) {
|
||||
res.sendFile(path + "index.html");
|
||||
});
|
||||
app.get('/messages/edit/:id', function (req,res) {
|
||||
res.sendFile(path + "index.html");
|
||||
});
|
||||
app.get('/messages/list', function (req,res) {
|
||||
res.sendFile(path + "index.html");
|
||||
});
|
||||
app.get('/message-tokens', function (req,res) {
|
||||
res.sendFile(path + "index.html");
|
||||
});
|
||||
app.get('/messages/send-message', function (req,res) {
|
||||
res.sendFile(path + "index.html");
|
||||
});
|
||||
app.get('/messages/sent-messages/list', function(req, res) {
|
||||
res.sendFile(path + "index.html");
|
||||
});
|
||||
app.get('/center-phones', function (req,res) {
|
||||
res.sendFile(path + "index.html");
|
||||
});
|
||||
app.get('/center-phones/edit/:id', function (req,res) {
|
||||
res.sendFile(path + "index.html");
|
||||
});
|
||||
app.get('/center-phones/list', function (req,res) {
|
||||
res.sendFile(path + "index.html");
|
||||
});
|
||||
app.get('/employees/list', function (req,res) {
|
||||
res.sendFile(path + "index.html");
|
||||
});
|
||||
app.get('/employees/:id', function (req,res) {
|
||||
res.sendFile(path + "index.html");
|
||||
});
|
||||
app.get('/employees/edit/:id', function (req,res) {
|
||||
res.sendFile(path + "index.html");
|
||||
});
|
||||
app.get('/customers/list', function (req,res) {
|
||||
res.sendFile(path + "index.html");
|
||||
});
|
||||
app.get('/customers/:id', function (req,res) {
|
||||
res.sendFile(path + "index.html");
|
||||
});
|
||||
app.get('/customers/edit/:id', function (req,res) {
|
||||
res.sendFile(path + "index.html");
|
||||
});
|
||||
app.get('/customers', function (req,res) {
|
||||
res.sendFile(path + "index.html");
|
||||
});
|
||||
app.get('/landing', function (req,res) {
|
||||
res.sendFile(path + "index.html");
|
||||
});
|
||||
app.get('/users', function (req,res) {
|
||||
res.sendFile(path + "index.html");
|
||||
});
|
||||
app.get('/medical', function (req,res) {
|
||||
res.sendFile(path + "index.html");
|
||||
});
|
||||
app.get('/medical/index', function (req,res) {
|
||||
res.sendFile(path + "index.html");
|
||||
});
|
||||
app.get('/medical/events/list', function (req,res) {
|
||||
res.sendFile(path + "index.html");
|
||||
});
|
||||
app.get('/medical/events', function (req,res) {
|
||||
res.sendFile(path + "index.html");
|
||||
});
|
||||
app.get('/medical/events/request', function (req,res) {
|
||||
res.sendFile(path + "index.html");
|
||||
});
|
||||
app.get('/medical/events/request/list', function (req,res) {
|
||||
res.sendFile(path + "index.html");
|
||||
});
|
||||
app.get('/medical/events/edit/:id', function (req,res) {
|
||||
res.sendFile(path + "index.html");
|
||||
});
|
||||
app.get('events/create-from-request', function (req,res) {
|
||||
res.sendFile(path + "index.html");
|
||||
});
|
||||
app.get('/medical/events/:id', function (req,res) {
|
||||
res.sendFile(path + "index.html");
|
||||
});
|
||||
app.get('/medical/events/multiple-list', function (req,res) {
|
||||
res.sendFile(path + "index.html");
|
||||
});
|
||||
app.get('/medical/resources/list', function (req,res) {
|
||||
res.sendFile(path + "index.html");
|
||||
});
|
||||
app.get('/medical/events/calendar', function (req,res) {
|
||||
res.sendFile(path + "index.html");
|
||||
});
|
||||
app.get('/medical/resources', function (req,res) {
|
||||
res.sendFile(path + "index.html");
|
||||
});
|
||||
app.get('/medical/resources/edit/:id', function (req,res) {
|
||||
res.sendFile(path + "index.html");
|
||||
});
|
||||
app.get('/medical/resources/:id', function (req,res) {
|
||||
res.sendFile(path + "index.html");
|
||||
});
|
||||
app.get('/signature/:id', function (req,res) {
|
||||
res.sendFile(path + "index.html");
|
||||
});
|
||||
require("./app/routes/user.routes")(app);
|
||||
require("./app/routes/auth.routes")(app);
|
||||
require("./app/routes/employee.routes")(app);
|
||||
require("./app/routes/vehicle.routes")(app);
|
||||
require("./app/routes/customer.routes")(app);
|
||||
require("./app/routes/client.routes")(app);
|
||||
require("./app/routes/staff.routes")(app);
|
||||
require("./app/routes/route-path.routes")(app);
|
||||
require("./app/routes/route-path-template.routes")(app);
|
||||
require("./app/routes/upload.routes")(app);
|
||||
require("./app/routes/report.routes")(app);
|
||||
require("./app/routes/message.routes")(app);
|
||||
require("./app/routes/resource.routes")(app);
|
||||
require("./app/routes/center-phone.routes")(app);
|
||||
require("./app/routes/message-token.routes")(app);
|
||||
require("./app/routes/calendar-event.route")(app);
|
||||
require("./app/routes/doctemplate.route")(app);
|
||||
require("./app/routes/xlsxtemplate.route")(app);
|
||||
require("./app/routes/timedata.routes")(app);
|
||||
require("./app/routes/breakfast.routes")(app);
|
||||
require("./app/routes/event-request.routes")(app);
|
||||
require("./app/routes/signature-request.routes")(app);
|
||||
require("./app/routes/snack.routes")(app);
|
||||
require("./app/routes/lunch.routes")(app);
|
||||
|
||||
// set port, listen for requests
|
||||
const PORT = process.env.PORT || 8080;
|
||||
app.listen(PORT, () => {
|
||||
console.log(`Server is running on port ${PORT}.`);
|
||||
});
|
||||
Reference in New Issue
Block a user