Skip to content

Commit

Permalink
init
Browse files Browse the repository at this point in the history
  • Loading branch information
truethari committed Jun 11, 2023
0 parents commit f7d1330
Show file tree
Hide file tree
Showing 5 changed files with 981 additions and 0 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/node_modules
9 changes: 9 additions & 0 deletions config/default.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"app": {
"port": 3000
},

"db": {
"mongoUri": "mongodb://127.0.0.1:27017/DriverSafe"
}
}
19 changes: 19 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
const express = require("express");
const config = require("config");
const mongoose = require("mongoose");

const app = express();

app.use(express.json({ extended: true }));

app.get("/", (req, res) => {
res.send("Hello World!");
});

mongoose.connect(config.get("db.mongoUri")).then(() => {
console.log("Connected to MongoDB");
});

app.listen(config.get("app.port"), () =>
console.log(`App has been started on port ${config.get("app.port")}...`)
);
Loading

0 comments on commit f7d1330

Please sign in to comment.