Sharing interface interface/model files between express and angular

Viewed 733

I am building an app using an Express backend and Typescript, and the frontend in Angular. For most of the services I will be writing for the frontend, I already have interface/models written for the backend. I would like to be able to share them without duplicating the files.

My dir structure looks like this....

backend: project_root/src/models/some.model.ts

fronend: project_root/client/src/app/models/some.model.ts

beyond this, i am not sure what to do with my config so that I can share the interface files between the backend and frontend. Thoughts?

1 Answers

Thoughts

Without changing the structure too much, just add a common folder:

  • backend: project_root/src/models/some.model.ts
  • fronend: project_root/client/src/app/models/some.model.ts
  • common : project_root/common/something.ts
Related