Access HTML page hosted on different server using NodeJS - html

Brief :
I have a static HTML/JS/CSS website hosted on a server called A. (I have access to it.)
And I have NodeJS server running on server B. Now I want to apply the Authentication mechanism using PassportJS Local strategy.
Questions :
Is it possible to apply authentication using this way?
What are the ways that I can show an HTML page from the server A when the request is made on the NodeJS server?
Any advice/information/help is awesome.
Thanks in advance.

Related

How to change path of socket.io in socket.io.slim.js

I am using socket.io for multiuser experience in one of our metaverse projects. We have deployed the code in a https server and after deploying the multiuser experience collapsed. When check for errors, we have found the following error.
enter image description here
enter image description here
we need to change the path of Url for where it needs to look for socket.io.
Can someone suggest any ideas for changing this path?
This usually means one of 2 things:
the socket.io server is not running
the socket.io server is running on a different place
Make sure socket.io is using the HTTPS server, not the HTTP one, and the client is connecting to the correct domain.

how can we connect MYSQL with html

i want to connect my data base with html web side please tell me how can i connect the html website to MY SQL.
You need to use PHP and setup a Localhost webserver, something like Wamp or Xamp will do.
I personally use Wamp, you can make a Database in the PhpMyAdmin service provided with it.
To further setup and connect to your database, you can simply search on google for some more detailed steps regarding to database connections.
but using a local webserver and php should get you up and running.
You need to use backend script/service to achieve the goal. You cant make connection directly. In between database and frontend (your html pages) there is backend.
to achieve your goal you can use php, node js which has n number of tutorials available.
Your question is getting minus points because it is incomplete and very basic.
Thanks

What are the risks of connecting to database directly from Electron app?

I'm fairly new at building Electron apps and I've seen a lot of examples where Electron app connects directly to a remote database (MySQL in my case) so I started wondering what the problems might be with doing it that way. My first thought was to have a remote API (built on top of Express) which would communicate with the database and Electron app (React) would just utilize that API.
Any advice? Thoughts?
Thanks.
A problem with directly connecting to the database is you have to embed the database credentials in the electron app which makes them available to anyone who wants to snoop through the code. In addition, once the credentials are exposed, you lose control over what anyone can do to your database.
This is why you would usually give the user their own credentials, have the user authenticate to a web server and then have the web server be the only one who can directly talk to the remote database. You can then completely control what happens to the database since your web server is the intermediary and the only one that actually talks to the database.
This doesn't mean that there aren't some circumstances where you might want the client to talk directly to the database as it really depends upon what you're doing, what the data is and what the risk exposure is for allowing untrusted code to directly manipulate the data in the database.
Remember, you cannot protect credentials embedded in a client. They can be discovered by the client and used for other things.

Can we access Mysql database using apache cordova without using php

I am a student and I am creating android app using apache cordova.
I want to access MySql Database of hosted website using apache cordova.
Please suggest me how can I do it.
Thanks in advance
For accessing that DB, you need to make a server API, you dont have to make it in PHP, there are a lot of technologies, but you can't do it directly from the client side (cordova).
Google for API REST or web service and choose your technology.

Turn static website into a dynamic website

I just wanted to know how can i turn my static website into a dynamic website. I have created a static HTML website and want to turn it into a dynamic website. Can anyone tell me what steps should i take? Thank you!
A dynamic website means to use server sided scripts for the creation of the websites which are controlled and processed by the server before being sent to the client. It will be simple so learn php or other server sided languages such as asp.net and get a server or hosting service or just install XAML or WAMP on your local machine so that an apache server environment is created. And then re-construct your pages with .php as its extension and then reconsruct the pages using php script. Learn Php its simple. Any more clarifications just comment