Netflix / falcor-express

Express Middleware for Hosting Falcor Data Sources.
Apache License 2.0
62 stars 25 forks source link

change API to return only route handler #11

Closed jhusain closed 9 years ago

jhusain commented 9 years ago

Currently we use the term "middleware" which i think is inappropriate. Usually middleware is code that executes before the code that finally emits the response. Middleware tends to handle transparent portions of the pipelined like authentication for example. The handler that we provide for serving model data is responsible for serving the actual response. We should rename expressMiddleware to "modelRoute".

var falcorExpress = require("falcor-express"); app.use("/model.json", falcorExpress.modelRoute((req, res)=> new Model(...));

cc @dzannotti for falcor-hapi

dzannotti commented 9 years ago

I think modelRoute name is incorrect, since it takes a Data Source generator function. Probably a better name would be something to do with service, or with data source exposure to web exposeDatasource ?

Ultimately the authentication part is contained in falcor-express making a middleware too (even tho not a pure one), for this reason i stand by exposeXXXXX being the correct wording (but then again i'm not even native english speaker)

jhusain commented 9 years ago

We ended up using only data source route.