ndelvalle/generator-api

Why not default routes to http:/server/api/object instead of http:/server/object

aceymer opened this issue · 2 comments

Just curious why you did not use the syntax above?

Again, great API framework, very simple..
Just uploaded a version to heroku and it just works!

Hey @aceymer thanks! I'm really happy to see the project is being useful 🙂.

I'm assuming the project is going to be a RESTful api, so In my opinion having the route /api/something seems a bit redundant. If you are thinking on having more functionality than just REST routes on the project, like routes to implement server-side page rendering, I would use your suggested syntaxis.

But that is just my opinion, you can easily change that when declaring the routes as middleware in the index file, example:

app.use('/api', myRouter);

thx