A
A
Anton Anton2017-03-14 11:26:12
Node.js
Anton Anton, 2017-03-14 11:26:12

How to share a model into two applications?

Is there an easier way than moving the model into a separate npm package and using it in both applications?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
K
Konstantin Kitmanov, 2017-03-14
@k12th

Keep both apps in the same folder? Connect the module in application 2 to the absolute path in the system?
And what's so hard about creating a package? :)

B
BestJS, 2017-03-15
@BestJS

Directory example:

├───libs
│   └───log.js
├───Server
│   └───app.js
├───Worker
│   └───app.js

In the app.js files, we connect to log.js like this:
let log = require("../libs/log")

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question