Well, youâve got me on that one. Sounds like nodemon canât start your server. Did you put the proper path to your server.js file? Iâm guessing itâs not int he same folder as Ionic?
hmm, well your gulpfile is in there too. Sorry this one is much harder for me to say. Maybe try nodemon ./server.js?
Itâs in the same folder as your gulpfile from the looks of it, so I guess Iâd think that would work? You could also try that solution from the stack overflow I posted. You could check what directory you are in when gulp runs by changing the shell script to âpwdâ to print the working directory, or to ls (or dir on windows) to see what files are in there. Just to confirm youâre in the right folder.
Well, when I run in the browser with the bash âIONIC SERVEâ, everything works.
But when I run the bash command to emulate âIONIC EMULATE IOSâ my app opens normally, but does not work the login button that calls the server.js, which makes the connection with the mongodb.
Because Iâve been thinking ⌠in the emulator and in a real mobile there is no bash in the system, or should it work anyway?
UmmmâŚwhat? I mean, if you have your app trying to hit your dataservice via localhost it should actually still work in the ios emulator. And ya of course emulators and mobile donât have bashâŚbut what does that matter, youâll have your data service hosted somewhereâŚrightâŚ
No. I think you lack a basic understanding of how apps and apis work. I thought you wanted to start both with one command as a convenienceâŚit sounds like instead you think this is a requirement.
You have to host your node server and database somewhere. Itâs totally separate from your app.
var db
MongoClient.connect('mongodb://elton:123456@ds035026.mlab.com:35026/star-wars-elton', (err, database) => {
if (err) return console.log(err)
db = database
app.listen(3000, function() {
console.log('mongodb !!!');
console.log('listening on 3000')
})
});