admin管理员组文章数量:1279242
I have a question regarding creating a front-end for a nest-js API:
- Will this front-end be an entirely different project with regards to folder structure?
- Will it just 'call' the services from my API?
- How are my controllers of the API used, if the front-end just uses the services directly?
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
I have a question regarding creating a front-end for a nest-js API:
- Will this front-end be an entirely different project with regards to folder structure?
- Will it just 'call' the services from my API?
- How are my controllers of the API used, if the front-end just uses the services directly?
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
Share Improve this question asked Dec 1, 2018 at 18:43 Alex5207Alex5207 4842 gold badges8 silver badges19 bronze badges1 Answer
Reset to default 7You can create separate project for frontend app, or you could return HTML directly from nest. This depends on what you want.
https://docs.nestjs./techniques/mvc
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 bine 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.
本文标签: javascriptCreating a front end for a nestjs APIStack Overflow
版权声明:本文标题:javascript - Creating a front end for a nest-js API - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1741295402a2370788.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论