AdamVig / GoCoApi

API Server for the GoCoStudent app.
https://gocostudent.adamvig.com/api
GNU General Public License v3.0
0 stars 0 forks source link

Convert endpoint helper function to class #23

Closed AdamVig closed 8 years ago

AdamVig commented 8 years ago

The endpoint loading process has several parts:

  1. Endpoint is defined in routes/routeName.js. This file contains metadata about the endpoint and functions to get and process data.
  2. Endpoint definition file is require()ed from index.js when the app starts.
  3. The .endpoint() function in the endpoint definition file defines the endpoint on the app object.

It would be better to reduce the responsibility of the route definition files by moving instantiation of the routes to index.js and using an Endpoint class. This has many benefits:

See #11, section on endpoint classes.