I’m developing both web and mobile app from the same repo, using the same code base and resources for both.
The problem is that I can run web server OR cordova app one at a time, but I can’t run them both at the same time, so that mobile app connects to that local server (http://localhost:3000) instead if its own (bundled one).
When one is already started, starting the second one throws Unexpected mongo exit code 100 error, meaning that the mongo connection is already in use (by the other one).
I’ve already tried
meteor run ios-device --mobile-server=http://localhost:3000
but no luck.
So, it’s only for development/debugging, not for deployment/production.
Is that even possible or I have to separate and run them from respective dirs?
So I had a similar requirement. The solution for me was to use micro-services.
1 Meteor App for the browser application
1 Meteor App for the mobile application
Shared code symlinked into both apps
So in the end, you would run two meteor servers on two different ports.
This was easier for me than packing all that code into one app. Actually, I have 4 meteor apps using the shared code with different front-ends like this.
May not be the best solution for you, but think about it.
The solution was actually very simple and @serkandurusoy pointed me in the right direction.
I was worried that db connection error is just one in many, happen to occur first and others might appear when the connection sorts out, but fortunately I was wrong
All I needed to do is setting the env variable and it started to work!
MONGO_URL=mongodb://localhost:3000/myapp meteor run ios-device
(Assuming, of course, that the web app is already running )
I was really not looking forward to separating the project into web and mobile parts, so this saved me from that
BTW, these apps will not use MongoDB in the end, but Postgres via Apollo, so I didn’t want to have to install MongoDB and manage it just for development.