some server enchantment thoughts
DmitryEfimenko opened this issue · comments
Currently server's code is written in js. We could step up the game and use TypeScript, just like the client side does it.
This would require the build to output files in the "dist" folder, which means things would have to be rearranged a bit in there (currently prod build puts whole client code in the root of the dist folder. We'd have to put it in the "/dist/client").
Another improvement would be setting up a watch task on server files and restarting server on change.
@DmitryEfimenko , I have some idea, but maybe after implementation of Redis
integration.
@DmitryEfimenko , I had created another issue for some new additions:
#5.
Improve routing idea
Currently if you want to add another route, you have to touch multiple files:
- create file with actual route
- import it to the index of a whatever service
- init it in routes.ts
In case you want to have a more complex hierarchy, there would be even more files to touch (ex: user/preferences/domains/add
)
I wrote some code that I use in some of my apps that automates this a bit. With it, you'd only need to touch two places:
- create file with route handler function (say in this location:
routes/user/preferences/domains/add
) - write the route that connects the url to the handler function. Something like:
router.post('api/user/preferences/domains/add', routes.user.preferences.domains.add)
Basically the routes
object generates automatically by walking through the folder routes however deep nested.
Do you think this would be a good addition to the project?
@DmitryEfimenko , interesting idea. I think it will a good improvement.
But we need to keep in mind, that @angular routes
and express routes
need to do not conflict, maybe we will need some gulp
checker task for this one to prevent this case
if developer will try to use route
that is used by @angular
. I will think about it.