I'm coming to node from a php background and I'm having a little difficulty deciding how to structure my training application. I've opted to use a MVCS based model, which aside from not quite having dependency injection worked out yet, is working very well for my traditional endpoints.
Obviously one interesting thing node can support is async sockets, which I have some basic examples of. So far I've successfully shoved my socket code into a nice service class which I'm currently starting from the main app.js file for the application (I am using express and io.js).
I'm struggling to find a good way to organise the socket code. Its not really a route, since it should just run in the background (as far as I can see). Can sockets be sanely handled through middleware? Again that seems to interfere with the async nature of the sockets. Do I want to add a new layer to my application specifically for sockets?
via tracer tong
No comments:
Post a Comment