Connection mysql credentials ElectronJs - javascript

I am currently using Mysql in my electron application, so I started to verify the .asar file when I compiled it, I could see that all the application code is shown, so I think the Mysql connection would be very vulnerable, there is some way to correct this?
Image:

Related

mongodb npm preventing application to run on www, yet runs on localhost

I have this node.js accounts app that I'm trying to implement a mongoDB database onto, but it seems to have errors when I upload it to cpanel. My mongoDB url is in this format: mongodb+srv://:#. After some experimenting, turning the Node.js version to ^14 caused errors to stop, but the app still wouldn't run (going to the url reslted in a 503 error, this is the current state of the server).
github: https://github.com/codingtuba/accounts.aimedtuba/tree/mongodb
before mongo DB: https://github.com/codingtuba/accounts.aimedtuba

ReactJS client and ExpressJS backend application production problems

I am new in reactjs and nodejs.I made an application with react frontend and express backend. There are axios post and get requests for get data from mssql database via express.
When the project in production level, I write the IPv4 address and port for access dashboard from another device in local network. After build,when I use for example localhost:5000 for requests, I can see all datas which are come from database in the device which react project running but with this I cant see datas from android phone in local network.
What should I do? Isn't there any other way than writing a static IP address? This project can be run different machines.
I am sorry for my spelling mistakes.

How can I set database authentication in Mongodb - Is SSH Pipes better for MongoDB?

I have installed MongoDB in my computer. I did't define any password and username for the installation. I can see everything with Robo 3T.
Now I want to protect my database.
I have tried to set authentication for the database. I followed https://docs.mongodb.com/manual/tutorial/enable-authentication/ . It did not work.
I still can reach mongodb with robo 3t and see all information.
I have also tried to start mongodb with --auth parameter. I have define a configuration file looks like
And for starting mongodb
mongod -f C:\mongodb\conf\mongodb.conf
Mongodb has been started but, it did not ask any pass. And I can save simple data with Postman without authentication.
What I want to do:
Protect my database against Robo 3t. :))
I dont want to save any data without auth.
Building Nodejs connection string that include pass like
mysql://root:password#localhost:port/dbName
Here is my Nodejs index.js code
this is my model.
PS: I am very new in Nodejs and Mongodb.
EDIT: inside conf file

How do I add information to my Heroku database?

I am currently trying to deploy a Node.js application to Heroku. The website is working until I try and login or do other operations that call the database. I have the database attached and keep getting the Error: write EPIPE error. From what I can tell from my research, it seems like I need a worker process. Right now I have my web process as ./bin/www and I do not know what to set my worker process to. I tried setting it to the same thing, but the app crashes. How do I add information from my app to a Heroku database?

Point mongoos.connect at localhost mongodb

I am studying the MEAN stack by using this tutorial. But the tutorial connects to a remote mongodb installation. I have MongoDB running in the CentOS7 localhost.
How do I alter the mongoose connect line in server.js from the tutorial link above to connect to a localhost database instead of a remote database?
Here is the current line from server.js that needs to be changed to point to the localhost mongodb:
mongoose.connect('mongodb://node:nodeuser#mongo.onmodulus.net:27017/uwO3mypu');
A specific mongodb database has not been created yet. Do I need to create that also?
I'm fairly new at Mongo to, but I know how to connect to a local db. Basically I had to do the following:
Download the latest version of mongodb from https://www.mongodb.com/download-center?jmp=nav#community (according to your settings)
Once installed, I've created a folder that will be containing my DB.
Use a command line instance to start mongo like this:
mongod --dbpath [YOUR_DB_PATH]
Created a DB use mydb
With that you should have already a mongodb db instance looking for connections on default port. So you can change that line for this:
mongoose.connect('mongodb://localhost:27017/mydb');
Again, this is really basic and it is creating a mongo DB connection with all default options. So this will keep you rolling, but you may need to dig a bit more for custom options.
Hope this helps

Categories

Resources