Hi All! Hopefully this is the right place to ask this, I have searched around for answers on these questions but haven't came across anything definitive so though I would try them here. Basically I am making an API which will contain several services and also need to supply JS files for use within other clients. All of this is protected by an API token. I am using the framework Adonisjs to handle this and have all of the auth setup but now that am moving onto the actual implementation of the services I have a few queries. Note: Any examples below are just examples as I cannot disclose much about the actual API.1 - By service I mean for example one service may send a list of items in the request and it will need to return the price of each item, another service could be calculating the total prices of a list that is requested, etc. Is it best practice to create a Service provider for each service and then call that within the controller to handle the request? Or should I just create my own class per service and call this when required in the controller? Or is there a better way structurally for this?2 - For serving JS files, I don't want these to be public so I was planning to hide them behind the Auth middleware as well and not placing them in the public folder, since this is the case where would the best place be to create these structurally, should they live within the services folder or should i create their own folder? Or should I place them in the public folder but find a way to lock down the folder?If you need anymore information ask away, I will be back in a couple of hours and if you have any feedback or suggestions I would be extremely grateful. I am just wanting to make sure as this is the base of a bigger project it starts off with solid foundations.
Submitted September 17, 2018 at 05:11PM by Cinama
No comments:
Post a Comment