Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

How to share code between firebase functions and Angular client? #2795

Unanswered
jmagaram asked this question in Q&A
Discussion options

I want to share some code like Typescript type definitions and some basic functions to operate on these types between my Angular client and the firebase functions. These types would be used in the client to populate Firestore. Similar types are used in functions. And I've got some unit tests that will use shared functions to create these types, etc. Although I would assume this is a very common request I can't find much code or information about how to do it. I'm following the suggestions in the link below and got it working. Basically there is a shared folder at the root of my Angular CLI folder with a package.json in it. I build a private NPM package and copy it around to the client and server pieces. It requires some build automation so each time I change code in the shared folder the new private NPM package "tarball" is made and copied around, and then the npm install command is executed in these places.

Is this a common need - to share some code between client and server?
Has someone written up a simple explanation for how to do it?
Is my approach the simplest way to do it?

https://fireship.io/lessons/how-to-structure-a-large-web-app-project/

You must be logged in to vote

Replies: 2 comments

Comment options

I think this approach is simple .

I also made the structure in this link's way

You must be logged in to vote
0 replies
Comment options

You could make usage of NX Workspaces and setup the whole infrastructure following: nrwl/nx#836 (comment)

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet

AltStyle によって変換されたページ (->オリジナル) /