phonegap doesn't connect with xampp server on localhost - javascript

I have a PhoneGap project on my windows 7 PC. I have installed the PhoneGap developer app on my PC which connects through server address: http://192.168.1.16:3000.
When I load the project on the PhoneGap developer app, everything works fine. The problem is that I have a database which is saved locally on my PC (localhost) and I access it through XAMPP. When I setup the XAMPP server I can not access the database and when I run the project it's showing me an error.
If I connect an online database on a server it works. I mean it's working with an online database but not working on localhost.
Can anyone help me how to access my database on localhost server.
var url = "http://localhost:81/myapp/auth.php";
And if i run open this link on above image result here:
enter image description here

Your app is running on the Phone and interprets localhost as its own host.
Try to use the IP you get from your Router of your PC smth. like 192.168.x.x or so.
Also be aware that direct connections to your PC-Database may be blocked because of the listen config of your MySQL Server

Related

Getting ERR_CONNECTION_REFUSED on my node api called from angular app on remote device access

I have an Node App and an Angular App running on my System (LG Gram- Windows), and the node server is my API server and the angular App is consuming those APIs. The Angular server is served with --host 0.0.0.0 so that I can access the app through out my Local Network (WiFi). I tried to access the Angular app with my phone and other laptop (HP - Ubuntu), both the devices was able to access angular app, but the login call(Through the Angular APP) to node API from my phone is giving me an error, but the Ubuntu system is fine. I tried calling the Node API directly from both devices and was able to access it and got a response. The Ubuntu system had the same issue with login but it was somehow fixed. What could be the issue.
I have fixed the issue, Since both the Node and Angular server was running on the same machine, i have set the API url as http://localhost:4000/api which worked on the same laptop but not on my android device, which in fact is calling http://localhost:4000/api for the api calls, hence connection error (no server on port 4000 on my android device). When i changed the url to http://192.168.31.82:4000/api, my local network IP, it worked.

Move my MERN app (developped on windows) on a ubuntu machine and access it via LAN network

It's my first time here so please bear with me :)
Basically i developped a full stack MERN web application on my windows 10 machine (node js, express js and Mongodb in the backend + database and react js for the frontend), to run each one of them for now i use vscode (nodemon server for the backend and npm start for the front) all are running on my localhost on different ports.
what i need to do is to move that MERN app to an ubuntu machine and make it accessible via LAN network of that ubuntu continuously.
i guess i need to use git to move the app from windows to ubuntu? (correct me if i'm wrong) but how to make it run correctly there? and should i install a specific server to run it all on the LAN?
Thank you for the help in advance !

How to start big nodejs project virtual classroom?

Developers i'm a nodejs developer with a experience of 1.5 years working in the company my question is i'm doing a project which is called a virtual classroom like a webinar platform where chat support, drawing and etc functionalities are available, so from last 2 month had been done of working in project i had gone through the each component directory and file with it's documents also they have used of docker, redis, proxy server, nginx, session, mongodb these kind of services and it's working fine on server end side but can't able to stablish on my local machine and it's a linux based project where have numbers of powershell files with PM2 library to make it run... so i followed a docs with some code also i success to make the service on and registered a local domain also in hosts file or nginx custom configuration it is working fine... but when i hit my ulr on browser with the local domain it not going to any of the route....
Example - like if we make a node simple project with hello world and it will working on 4500 port so we write localhost:4500 and it will print our responce on browser
but if the run my project through a PM2 or a simple node app.js bcoz this app.js have connected with all nodes services and virtual classroom and you the linux platform we don't need to make serivice on it's by default in runing state monogoDB, redis, docker, nginx but the real question is while firing the command node app.js it shows some json and told port:2178 but when in hit this on browser localhost:2178 not responce to GET request why??? but there is route called localhost:2178/landing/session/v1/classid(which is encrypted code) this url not working what to do ??

network request failed when running expo app on android device

I am using a localhost server for my app development on expo. I get this error on my android device.
My server and api works fine as I have tested it on postman. It works well in the browser too. I am already using my ip address in the fetch function instead of localhost.
The fetch also works fine on genymotion android emulator. The issue is only on my actual android device.
Thanks
Solved the issue finally. The issue was my firewall(ufw) which was not allowing access for public ports.
sudo ufw allow from 192.xxx.x.xxx to any port 80 helped me as it allows acces to publicly open ports.
Thanks

Deployed database has no connections

I have deployed an application to heroku: https://stark-citadel-91743.herokuapp.com/
The app initially loads properly until you click a button that requires the database. Then it crashes.
Everything works in local development environment. I believe I have properly set up all connection settings for production in heroku dashboard's config variables (database url, database name, username, password). But in production it doesn't work.
Two evidences that it's not set up right:
1) When I log into the ClearDB MySQL plugin (in my heroku dashboard) under 'current connections' it says, 'No connections are currently established to the database.'
2) When I use postman to hit a custom endpoint I made just for testing a request to the database, I get: "Error adding color: Error: connect ECONNREFUSED 127.0.0.1:3306" <-- that 127.0.0.1 seems enlightening. Why would a deployed db have a connection on that address?
Any clues? Thank you!
If your database is also set up at keroku host:
check the db setting(username, pw, port,etc.)
If you actually need to connect back to your own database(which is hosted by you or other third party);
You should find out the setting and replace with 127.0.0.1:3306, which is only work for local env
Update:
127.0.0.1 is localhost, which is your machine. Your test case is working because your server and your database are hosting on the same machine(which both have same ip). However, when your code are deployed to heroku, your heroku server cannot find a database hosted on same machine. This is why your are having this problem

Categories

Resources