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 #1

Closed
hasezoey opened this issue May 27, 2019 · 3 comments
Closed

Question #1

hasezoey opened this issue May 27, 2019 · 3 comments

Comments

@hasezoey
Copy link

(from http://github.com/szokodiakos/typegoose/pull/96 )

  • why is this needed? / why typegoose on the frontend
  • could i have an example (use case)?
@HarelAshwal
Copy link
Owner

LK"I

Currently you need to declare the model in two places, in server side, and in client side.
the client side (for instance Angular compiler) can't use the server side model, because it has reference to server-only packages (e.g. mongoose).

The changes in this repo let you use the EXACT same model for both the client and the server.
(it detects if running on browser it will just ignore all typegoose specific code).

@hasezoey
Copy link
Author

i mean like, why is the model needed at all in the frontend, not just an interface?

@HarelAshwal
Copy link
Owner

you don't need it.
it just a convenient way to write code without duplicating the code (and write the interface for the model in client side).

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