app.js is getting big and doesn't know what it's responsible for anymore. Put the functions below line 23 (except for app.listen(300)) in different files, organized by concern and require them. When you're done, you should have something like this in app.js:
var indexHandler = require('./index_handler')
var searchHandler = require('./search_handler')
...
app.get('/', getIndexHandler);
app.post('/search', searchHandler);
app.js
is getting big and doesn't know what it's responsible for anymore. Put the functions below line 23 (except forapp.listen(300)
) in different files, organized by concern and require them. When you're done, you should have something like this inapp.js
: