fac-u / take-me-away

Travel
https://fac-u.github.io/take-me-away/
1 stars 3 forks source link

Modularise server.js further - create handler.js #27

Open jsms90 opened 7 years ago

jsms90 commented 7 years ago

handler.js to contain 2 functions:

msmichellegar commented 7 years ago

Definitely agree with modularising the server. Consider putting your routes in another file, then requiring them in like so:

const routes = require('./routes.js');

server.route(routes);

The functions you've named (processWeatherObject, processArticles) are not actually handler functions, but functions used within the handler for the '/' endpoint (if that makes sense), so maybe it would make more sense to put them in a file named something else.