Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
jsms90 opened this issue Nov 22, 2016 · 1 comment
Open

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

jsms90 opened this issue Nov 22, 2016 · 1 comment

Comments

@jsms90
Copy link
Member

jsms90 commented Nov 22, 2016

handler.js to contain 2 functions:

  • processWeatherObject
  • processArticles
@msmichellegar
Copy link

msmichellegar commented Nov 23, 2016

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants