Skip to content

Commit

Permalink
project setup completed
Browse files Browse the repository at this point in the history
  • Loading branch information
vijay4145 committed Jan 28, 2023
1 parent 4de1f34 commit e9f7309
Show file tree
Hide file tree
Showing 8 changed files with 44 additions and 26 deletions.
9 changes: 9 additions & 0 deletions server/app.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
const express = require('express');
const app = express();
const home = require('./src/routes/HomeRoute');


// routers
app.use('/', home);

module.exports = app;
18 changes: 4 additions & 14 deletions server/index.js
Original file line number Diff line number Diff line change
@@ -1,16 +1,6 @@
const express = require('express');
const app = express()
const port = 8000;
const app = require('./app');
require('dotenv').config();


app.get('/', (req, res) =>{
res.send("hello world");
})

// Routes
app.use('/events/upcomingEvents', require('./routes/Events/upcomingEvents'));


app.listen(port, ()=>{
console.log(`App listening at http://localhost:${port}`);
app.listen(process.env.PORT, ()=>{
console.log(`App listening at http://localhost:${process.env.PORT}`);
})
14 changes: 14 additions & 0 deletions server/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions server/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
"author": "",
"license": "ISC",
"dependencies": {
"dotenv": "^16.0.3",
"express": "^4.18.2"
}
}
Empty file removed server/routes/Events/pastEvents.js
Empty file.
12 changes: 0 additions & 12 deletions server/routes/Events/upcomingEvents.js

This file was deleted.

6 changes: 6 additions & 0 deletions server/src/controller/HomeController.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
exports.home = (req, res) => {
res.status(200).json({
success: true,
greeting: "Home controller working OK",
});
};
10 changes: 10 additions & 0 deletions server/src/routes/HomeRoute.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
const express = require('express')

//import homeController
const { home } = require('../controller/HomeController')
const router = express.Router(); // New router instance from express library

//routes
router.route("/").get(home)

module.exports = router

0 comments on commit e9f7309

Please sign in to comment.