SC5 / cerebellum

Cerebellum.js is a powerful set of tools that help you structure your isomorphic apps, just add your preferred view engine.
MIT License
106 stars 1 forks source link

Allow local API handlers to be called directly without HTTP overhead on server side #12

Open hoppula opened 9 years ago

hoppula commented 9 years ago

It should be possible to pass the server constructor a list of API routes. These routes could be handled directly without invoking a HTTP request.

We need a modified Axios adapter that checks for model/collection url's hostname (127.0.0.1 & localhost allowed) and checks if the API route exists in server's API routes list.

The actual route handler needs to be called with Express' request & response objects, so it can be also used as a regular API route over HTTP. We need to check how Express initializes these objects internally to be able to set the needed data for non-HTTP requests.

hoppula commented 9 years ago

Wrapper for https://github.com/yahoo/fetchr might be enough.