A
A
Adel Khalitov2019-02-17 17:34:23
JavaScript
Adel Khalitov, 2019-02-17 17:34:23

How to have common object interfaces between angular and nodejs?

Here it is conditionally, there is a front on the angular, a backend on the node.
On a mangodb db node, I use mongoose for ease of use.
I am creating a new schema interface to interact with the db.

LeadSchema  = new mongoose.Schema({
name: '',
address: ''
});

In angular, I display the data that nodejs sends to me.
In angular, I also create some kind of interface for the object, conditionally:
Lead: {
name: '',
address: ''
}

But as soon as I have a new entity in my object, I need to change them in 2 places.
I can have a large number of analogues of Lead. How to combine all this?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexander Pushkarev, 2019-02-17
@SaveLolliPoP

Take out these objects as separate entities and import them.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question