Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Question: SHARED Package #2

Open
johannesschobel opened this issue May 6, 2019 · 2 comments
Open

Question: SHARED Package #2

johannesschobel opened this issue May 6, 2019 · 2 comments

Comments

@johannesschobel
Copy link

Dear @elylucas , ionic team and community,

thank you very much for this nice tutorial on how to build a backend (with NestJS) and frontend (with Ionic) and the corresponding starter package here. However, i was wondering, if it would be possible to add some kind of shared package (besides the client and server package) that share some common models and interfaces.

Currently, for example, the server has strongly typed classes (e.g., the Mission), however, the client does not get this model definition.

On the one hand, this would reduce the need to maintain the same structures on client and server side. On the other, both parts (client & server) would work with / on the same structures. What do you think about this?

All the best

@ModestinoAndre
Copy link

@johannesschobel , Have you discovered a way to share code between Nest and Ionic, as you mentioned?

@johannesschobel
Copy link
Author

Dear @ModestinoAndre ,
thank you very much for picking up this issue. I switched to nrwl/nx (https://github.com/nrwl/nx), which is a framework that allows building multiple applications within one large workspace (i.e., a monorepository pattern).
Nx has generators for nest, angular and via 3rd party packages for ionic as well.

In this context, you can easily create a nrwl/workspace:lib that can be shared between client and server. This allows, for example, for creating some kind of shared interface package.

For more details, check out the Nrwl/Nx tutorial here (https://nx.dev/latest/angular/tutorial/01-create-application). Especially part 7 focusses on sharing data between client and server.

Hope this helps!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants