SQL not working when I use the network host on my phone or any other device - mysql

I am making a web-app currently and I'm using WebStorm for my front and back end. My stack is as follows: Vue3(with axios), Node.js (with Express and Coors as well as mysql and mysql2), and of course, MySQL which I am using a server from AWS.
Below is my code for allowing more than one localhost to connect to the backend Node.js.
const corsOptions = {
origin:["http://localhost:3000", "http://192.168.56.1:3000", "http://10.3.14.231:3000/"]
}
The last 2 in the array are the "Network" links I get when I npm run dev -- --host. I then get this in the terminal:
> Network: http://192.168.56.1:3000/
> Network: http://10.3.14.231:3000/
> Local: http://localhost:3000/
So far, when I type any of the links in network to my phone, it doesn't work for the SQL. The Display and front end pop up just fine, but when I make an account, Firebase will work, but nothing is sent to MySQL.
If there's any questions please ask for clarification. I don't know if this will be an issue when I actually launch it, but I can't find anything else on this problem.

Related

Cannot GET /api/forge/oauth/callback

Im trying to test out this demo on my own windows machine: https://github.com/Autodesk-Forge/forge-bim360-clashissue
Ive successfully started had the template running with these commands.
npm install
set FORGE_CLIENT_ID=<<YOUR CLIENT ID FROM DEVELOPER PORTAL>>
set FORGE_CLIENT_SECRET=<<YOUR CLIENT SECRET>>
set FORGE_CALLBACK_URL=<<YOUR CALLBACK URL>>
npm run nodemon
Ive added a new app within the Forge My Apps interface.
Ive added the provisions for the the BIM 360 Account interface.
I can connect to my localhost, and when i press ALLOW to try to authenticate and login to the autodesk account, i get redirected to the following website with the following error:
http://localhost:3000/api/forge/oauth/callback?code=TOAq...
Cannot GET /api/forge/oauth/callback
How can i get past this error?
It looks like a configuration mismatch. You have configured the callback to be http://localhost:3000/api/forge/oauth/callback but according to https://github.com/Autodesk-Forge/forge-bim360-clashissue/blob/master/server/endpoints/oauth.endpoints.js#L72 your server actually expects the callback on a different URL: http://localhost:3000/api/forge/callback/oauth.

React Native Login with Mysql database using fetch. getting : Network request failed error

so i'm trying to follow this tutorial for Registration : https://reactnativecode.com/react-native-user-registration-example-tutorial/#comment-878
i’m using WampServer on Windows 10. I did as mentioned.
I created a folder called “/react” under “C:\wamp64\www\react” and put the two .php files there .
when i put “localhost/react” in my browser i can see the .php files .
i changed the URL to : ‘http://localhost/react/user_registration.php’
But i’m still getting that error .. i’m not sure what i’m doing wrong here
This happens simply because react-native consider localhost as an URL but it doesn't have a domain :
Solution
On Windows =>
Run [Ctrl] + R
Then type : "cmd", press enter
write "ipconfig" then press enter
a list of IP configurations will show, copy the IP address besides "IPv4 Address", it's under "Ethernet adapter VirtualBox Host-Only Network #2:", it starts with 192.168.xxx.x
on MAC =>
http://osxdaily.com/2010/11/21/find-ip-address-mac/
You will now need to replace the URL with this IP Address
you will have this at the end : ‘http://192.168.xxx.x/react/user_registration.php’
as you've seen, i have replaced localhost to the ip address taken from the CMD [i.e IPV4 Address]
You can also use only free hosting website like Awardspace, 000Webhost to test your app on a real device. Use your local server or this ip address, you can't fetch the data from real device
Hope this will help you!
Franz

Debugging web application in service fabric - View error returns 404

I'm developing a web application (ASP.Net Core) in a servicefabric cluster, but every time I get an error in a razor view (for example a variable not set) I get a 404 error and not the well known error page which tells me what is wrong.
I have no clue as to why it does that or how I should solve it and can't find anything online. Can anyone point me in the right direction?
The project used to run outside the cluster and debugging worked there but since it's in the cluster it doesn't.
Visual Studio is currently not able to set the ASPNETCORE_ENVIRONMENT for Service Fabric Services.
You can workaround this problem by changing this code in the default Configuration method in your Startup.cs file to this:
//if (env.IsDevelopment())
if (env.ContentRootPath.Contains("SfDevCluster"))
{
app.UseDeveloperExceptionPage();
app.UseBrowserLink();
}
else
{
app.UseExceptionHandler("/Home/Error");
}
That should be a fairly safe assumption that you are running the application in a OneBox Service Fabric cluster.

Hosting a keystonejs app with openshift

I keep getting a 503 but no errors in the log when trying to host my keystone.js app on openshift, has anyone successfully hosted a keystone app with them? Everything works fine on localhost.
I am using a fresh install of keystone.js with no blog or cloudinary.
Your providing very little information to give you a definitive answer. What options are you passing to keystone.init()? Are you using dotenv? If so, what are you setting there? Did you set any environment variables using rhc set-env?
I ask because a common (though not by far the only) culprit of 503 errors in Node.js applications on OpenShift is a port number overriding OpenShift's. Keystone looks at process.env.PORT before it looks at process.env.OPENSHIFT_INTERNAL_PORT. So, if you have PORT set on your .env or with rhc set-env it will take precedence over OPENSHIFT_INTERNAL_PORT.
I came across a similar question on the KeystoneJS Google Group. In that other case the developer had added a MONGODB cartridge to his app, but had not set the connection string for the cartridge in Keystone.
If this is your case as well you need to set the Keystone mongo option in Keystone.init() or using Keystone.set('mongo', 'connection_sring'). When you created the cartridge you got a url and some credentials. OpenShit passes these to your application in environment variables. You can build the mongo connection string as follows:
var connectionString = process.env.OPENSHIFT_MONGODB_DB_USERNAME + ":" + process.env.OPENSHIFT_MONGODB_DB_PASSWORD + "#" + process.env.OPENSHIFT_MONGODB_DB_HOST + '/' + process.env.OPENSHIFT_APP_NAME;
keystone.set('mongo', connectionString);
or
keystone.init({
...
mongo: connectionString,
...
});
Or you can use rhc set-env to set the MONGO environment variable as follows:
rhc set-env MONGO=http://{username}:{password}#{connection url}/{dbname} -a your_app_name
The connection url above is the one you got from OpenShift when you created the cartridge. If looks like a standard MONGODB url (e.g. mongodb://127.6.85.129:27017/).
These are just my best guesses, given that your question is a bit thin on details. You may want to post some more specifics so we can more accurately assess your problem.

Beginner Ruby / MSQL Error

http://localhost:3000/genre
I'm using Instant Rails, I'm introducing scaffolding for the first time ever.
So everything looks like its working fine, I did my own RoR page etc, today i come in today and when I go to localhost:3000 I get the following error message:
Oops! Google Chrome could not connect to localhost:3000
Any suggestions of what I should check would be greatly appreciated. So far I know to confirm that:
the windows host file connects 127.0.0.1 to localhost
I've had an update to this the Mongrel server doesnt start properly with the new app I have created, rather than an open window, it just runs a script and closes the window without confirmation that it has started.
Thanks in advance.
here is the details of the Mongrel error:
C:\Users\Will\Desktop\instantrails\rails_apps\talewiki>mongrel_rails start -p 30
00
** Starting Mongrel listening at 0.0.0.0:3000
** Starting Rails with development environment...
C:/Users/Will/Desktop/instantrails/ruby/lib/ruby/gems/1.8/gems/activerecord-2.0.
2/lib/active_record/connection_adapters/abstract/connection_specification.rb:217
:in establish_connection': development database is not configured (ActiveRecord
::AdapterNotSpecified)
from C:/Users/Will/Desktop/instantrails/ruby/lib/ruby/gems/1.8/gems/acti
verecord-2.0.2/lib/active_record/connection_adapters/abstract/connection_specifi
cation.rb:208:inestablish_connection'
from C:/Users/Will/Desktop/instantrails/ruby/lib/ruby/gems/1.8/gems/rail
s-2.0.2/lib/initializer.rb:234:in initialize_database'
from C:/Users/Will/Desktop/instantrails/ruby/lib/ruby/gems/1.8/gems/rail
s-2.0.2/lib/initializer.rb:94:inprocess'
from C:/Users/Will/Desktop/instantrails/ruby/lib/ruby/gems/1.8/gems/rail
s-2.0.2/lib/initializer.rb:49:in send'
from C:/Users/Will/Desktop/instantrails/ruby/lib/ruby/gems/1.8/gems/rail
s-2.0.2/lib/initializer.rb:49:inrun'
from C:/Users/Will/Desktop/instantrails/rails_apps/talewiki/config/envir
onment.rb:13
from C:/Users/Will/Desktop/instantrails/ruby/lib/ruby/site_ruby/1.8/ruby
gems/custom_require.rb:27:in gem_original_require'
from C:/Users/Will/Desktop/instantrails/ruby/lib/ruby/site_ruby/1.8/ruby
gems/custom_require.rb:27:inrequire'
... 9 levels...
from C:/Users/Will/Desktop/instantrails/ruby/lib/ruby/gems/1.8/gems/mong
rel-1.1.2-x86-mswin32/bin/../lib/mongrel/command.rb:212:in run'
from C:/Users/Will/Desktop/instantrails/ruby/lib/ruby/gems/1.8/gems/mong
rel-1.1.2-x86-mswin32/bin/mongrel_rails:281
from C:/Users/Will/Desktop/instantrails/ruby/bin/mongrel_rails:19:inlo
ad'
from C:/Users/Will/Desktop/instantrails/ruby/bin/mongrel_rails:19
As it appears your Database has not been configured. Check out the APP_ROOT/config/database.yml file and find if you have created the database that corresponds to the development environment. Once you setup the DB, your code should run fine.