Wednesday 31 January 2018

What's a good way to organize my codes?

For a typical mid size application, I would have 2000+ lines in my index.js consisting of require(), .get routes, .post routes, static routes, the mandatory server.listen, and tons of db queries. Basically, EVERYTHING goes into index.js. Every time I want modify something, like say app.post('/profile', function() ..., I'd have to hit CTRL-F and find it.I recall seeing someone that I worked with organize them into different other .js and than requiring them in index.js. Are there ways to organize my codes better?

Submitted January 31, 2018 at 11:24AM by eggtart_prince

No comments:

Post a Comment