Skip to content

Commit

Permalink
backend added
Browse files Browse the repository at this point in the history
  • Loading branch information
akhilrgeorge007 committed Mar 18, 2023
1 parent c6ed2a6 commit df227d9
Show file tree
Hide file tree
Showing 13 changed files with 3,437 additions and 0 deletions.
23 changes: 23 additions & 0 deletions backend/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.

# dependencies
/node_modules
/.pnp
.pnp.js

# testing
/coverage

# production
/build

# misc
.DS_Store
.env.local
.env.development.local
.env.test.local
.env.production.local

npm-debug.log*
yarn-debug.log*
yarn-error.log*
8 changes: 8 additions & 0 deletions backend/config/app.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
const MONGO_DB_CONFIG = {
DB: "mongodb://localhost:27017/horacletest",
PAGE_SIZE:10,
};

module.exports = {
MONGO_DB_CONFIG
}
32 changes: 32 additions & 0 deletions backend/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
const express = require('express');
const app = express();
const mongoose = require("mongoose");
const { MONGO_DB_CONFIG } = require("./config/app.config");
require("dotenv").config();
const cors=require('cors');
const port = process.env.PORT;
const bodyParser = require("body-parser");
app.use(bodyParser.json());
app.use(cors());
//const swaggerUi = require("swagger-ui-express"), swaggerDocument = require("./swagger.json");

mongoose.connect(MONGO_DB_CONFIG.DB,{
useNewUrlParser:true,
useUnifiedTopology:true,
})
.then(
()=>{
console.log("Database connected");
},
(error)=>{
console.log("Database not connected"+error);
}
);

app.use(express.json());
app.use("/api/auth",require("./routes/auth.routes"));
app.use("/api/heart",require("./routes/heart.routes"));

app.listen(process.env.port || 4000, ()=>{
console.log("Server running")
})

0 comments on commit df227d9

Please sign in to comment.