Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

share code between angular and nodejs projects

I have some classes which were initially written for my Angular front-end, which I would also like to use in the NodeJS backend.

Those classes are written in typescript, while my NodeJS backend is written in javascript.

What would be the most straightforward way to share this code between both projects, so that both can use the same source code in the future?

It would be a bonus of course, if I could keep the code in typescript and private. But my fear is, that I will have to rewrite it to javascript and create a public npm package for them.

like image 513
bvdb Avatar asked Mar 12 '26 03:03

bvdb


1 Answers

You might want to take a look at Nx. It allows you to create libraries which can be shared between a frontend app (e.g. Angular) and a backend Node.js app.

like image 187
Blake Mumford Avatar answered Mar 14 '26 18:03

Blake Mumford



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!