Reputation: 484
I have a question regarding creating a front-end for a nest-js API:
Also, in what order does it make sense to create the front-end prior to auth? Or should it be the other way around.
Thanks
Upvotes: 7
Views: 16485
Reputation: 18389
You can create separate project for frontend app, or you could return HTML directly from nest. This depends on what you want.
If you go for server side rendering (the MVC link above), then your code will have direct access to your nest services. If you go for SPA approach (angular, react, vue, ...), then you will have to call your nest API via http, so you will have access only via your API endpoints.
I guess this one is answer already - for SSR approach, you will have endpoints that return the HTML. You could combine both approaches, having group of controllers working as REST API, and another group for SSR, that will return JSON response.
About the auth - I guess you should implement the backend first, then you can implement frontend so you can test it.
Upvotes: 7