Skip to content

Commit

Permalink
feat: add simple root route
Browse files Browse the repository at this point in the history
  • Loading branch information
kucengorenji committed Dec 18, 2021
1 parent 43fea92 commit 97d064b
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 0 deletions.
14 changes: 14 additions & 0 deletions server/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
const express = require('express');
const app = express();
const { PORT = 4000 } = process.env;
const router = require('./routes/index');
const morgan = require('morgan');

app.use(morgan('tiny'));
app.use(express.urlencoded({ extended: true }));
app.use(express.json());
app.use(router);

app.listen(PORT, () => {
console.log(`server is running on http://localhost:${PORT}`);
});
10 changes: 10 additions & 0 deletions server/routes/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
const express = require('express');
const router = express.Router();

router.get('/', function (req, res) {
res.status(200).json({
message: 'root is rendered',
});
});

module.exports = router;

0 comments on commit 97d064b

Please sign in to comment.