-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.js
More file actions
28 lines (23 loc) · 763 Bytes
/
index.js
File metadata and controls
28 lines (23 loc) · 763 Bytes
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
const express = require("express");
const app = express();
const mongoose = require("mongoose");
const routes = require("./app/routes.js");
const helper = require("./app/utils/helper.js")
const database = require("./app/core/database");
app.use(express.json());
app.use(express.urlencoded({extended: false}));
const assetsPath = express.static('public');
app.use(assetsPath);
app.use(helper.jsonResponseMiddleware);
app.use(routes);
app.use(helper.handleNotFound);
database.connect()
.then(() => {
app.listen(3000, () => {
console.log('Running on http://localhost:3000!');
});
console.log('Connection attempt completed.');
})
.catch((error) => {
console.error('Error starting the app:', error);
});