relocated routes to routes folder
This commit is contained in:
parent
0cad380e49
commit
f9c7359fd6
|
@ -4,6 +4,8 @@ const express = require('express');
|
|||
// Invoke express app
|
||||
const app = express();
|
||||
|
||||
const APIRoutes = require('./routes/api');
|
||||
|
||||
// Middleware to log requests
|
||||
app.use((req, res, next) => {
|
||||
let time = new Date().toLocaleTimeString();
|
||||
|
@ -11,10 +13,7 @@ app.use((req, res, next) => {
|
|||
next();
|
||||
});
|
||||
|
||||
// Setup Route for Testing
|
||||
app.get('/', (req, res) => {
|
||||
res.json({'message': 'Hello World!'});
|
||||
});
|
||||
app.use(APIRoutes);
|
||||
|
||||
// Listen on port set in .env
|
||||
app.listen(process.env.PORT, () => {
|
||||
|
|
|
@ -0,0 +1,9 @@
|
|||
const express = require('express');
|
||||
|
||||
const APIRoutes = express.Router();
|
||||
|
||||
APIRoutes.get('/', (req, res) => {
|
||||
res.json({'message': 'Hello World!'});
|
||||
});
|
||||
|
||||
module.exports = APIRoutes;
|
Loading…
Reference in New Issue