Reputation: 2775
I have a NX workspace with a NestJS API and an Angular client project (see folder structure).
It has an api-interfaces
library shared between the Angular client and the API, as appears below:
How can I add another library for constants and variables shared between client and api?
Upvotes: 1
Views: 1074
Reputation: 982
You can generate a lib in the same way:
npx nx generate @nx/js:library lib-data
In the prompt you choose jest and tsc, to make it compatible. The new lib contains a lib-data.ts file which you can fill with all your data:
export const max = 5;
export const allowedFormats = ['image/jpeg', 'image/png'];
Just import the lib in the same way like the interface lib. Then you are able to use all exported constants.
Upvotes: 0