Structured Programming Sandbox
The main reason for structured programming is maintainability. Node programs are structured in the following ways:
- Clear, self-documenting API structure
- Make JS subroutines out of any code that is repeated (duplicated) across any group of APIs
- MongoDB data access routines can be partitioned for shared use, granular down to the field level
- Prototype your app with Node templates first -- go as far as you can go before SPA breakout
- Like any module, an API needs to accommodate exactly the funtionality required, and no more; single place to update
Structured APIs example:
app.get('/next_question/:visitor/:token', function (req, res, next) {});
app.get('/links/:frame/:impression/:visitor/:url_text', function (req, res, next) {});