Skip to content

Commit

Permalink
[Refactored server.js | Added utils] Refactor shravan20#10 Moved sta…
Browse files Browse the repository at this point in the history
…tements as functions into app.js from server.js , renamed helpers as utils
  • Loading branch information
shravan20 committed Nov 17, 2020
1 parent 67b1625 commit 3860531
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 7 deletions.
9 changes: 2 additions & 7 deletions server.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,3 @@
const express = require('express');
const app = express();
const port = process.env.PORT || 3002;
const serverInstance = require('./src/app');

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


app.listen(port, () => console.log(`App listening at http://localhost:${port}`));
serverInstance.initiateServer();
17 changes: 17 additions & 0 deletions src/app.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
const express = require('express');
const port = process.env.PORT || 3002;


const initiateServer = () => {

const app = express();

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

app.listen(port, () => console.log(`App listening at http://localhost:${port}`));

}

module.exports = {
initiateServer
};
File renamed without changes.
File renamed without changes.

0 comments on commit 3860531

Please sign in to comment.