Connecting to external database using React, Nodejs, Express, and PostgreSQL - node.js

I created a course management system using PHP and HTML. I use PostgreSQL to store data. I use my school's server and database where I could put my files on there with WinSCP and can connect to the database with putty via SSH where I can run queries. Everything works fine.
I am trying to do the exact same project using React, Nodejs, Express, and PostgreSQL. All the tutorials I see online show how to connect to a local database. I want to eventually publish this project and for it to communicate with the same database as my PHP project. Is that possible? So far, I was able to build the client-side of the application(react) but have not been able to communicate with the database (server-side). Any tips?

Related

How to connect Meteor Js application with mongoDB

I start work on fresh application of MeteorJs and facing problem with mongoDB connection with application and have research a lot regarding this but not get any proper solution.
I need to connect my MeteorJs Application with MongoDB and research about this issue but didn't get any solution.
If you are using Meteor Cloud then you should stick to the official docs: https://galaxy-guide.meteor.com/mongodb.html#authentication
If you are using Meteor-Up (MUP) then you should check out the Mongo configuration: https://meteor-up.com/docs.html#mongodb
If you want to connect to a MongoDb with a custom deployment or your local development setup then you need to properly configure the MONGO_URL: https://docs.meteor.com/environment-variables.html#MONGO-URL
Don't forget to configure MONGO_OPLOG_URL as well: https://docs.meteor.com/environment-variables.html#MONGO-OPLOG-URL

Is it ok for a NodeJs API to have both MongoDb and MySQL(with prisma), but for different purposes?

Let me explain, so, I'm building this web application that visualizes data and the dataset that I'm working with is uploaded on a mongodb cluster. I'm also planning on making a login system using prisma and mysql. Should I build a new api for the whole user part or work with both databases in the same project?

I am trying to connect Angular to MongoDB

I have a simple Angular app and it is running in Local Host 4200. How do I save the form values and store them in a MongoDB database?
Angular is a web framework dedicated for the client-side, MongoDB is
a NoSQL database, to save your data put into your angular app to your
Database, you need a server-side implementation like nodejs or
python, java, etc ..
I recommend for you to use expressjs as an API framework it can helps you to get started
Angular is not supposed to connect directly to a DB in an real project, so there is not much of a point to practice doing so. You should have an server-side application or a mock to do so. If you are trying to build a front for studies you can use packages such as this one to begin: https://www.npmjs.com/package/auto-api
It is of simple use and you can save data without configuring or installing a DB.

one cloud server and running multiple node and mongo project

I bought a cloud server from digitalocean. I have a problem
I wrote a project that using node js web services and mongodb database I'm trying to setup node js and mongo db its okay but my problem is how can I deploy my node js app which will use mongodb and using my custom domain.
Now my domain at natro.com I can't complex with all of them any tutorial that you have known or something else can be helpful?
I don't know much about server management.
My server can be ubuntu or debian, doesn't matter, depends on tutorial or some blog post.
First step is add your domain in Network area of DigitalOcean Panel. Use this tutorial.
https://www.digitalocean.com/community/tutorials/how-to-set-up-a-host-name-with-digitalocean
Now, follow this tutorial for deploying your nodejs app with nginx
https://www.digitalocean.com/community/tutorials/how-to-set-up-a-node-js-application-for-production-on-ubuntu-16-04

Developing locally using express, mongodb and mongoose

I'm currently making an app using express, mongodb and mongoose, and I'm running it locally on my machine. My problem is that if I'm not connected to the internet the app won't run at all due to the app not being able to connect to mongodb server.
I thought that if I ran the mongodb server locally on my computer along with the app then I wouldn't need an internet connection, or is my understanding wrong?
Any help would be much appreciated.
The answer is: yes.
If you install MongoDB locally then you won't need internet connection to access it.
Make sure that your connection string contains "localhost".
Also, make sure that you don't need anything else on the internet, and that you run npm install while you are connected to the internet, or otherwise your dependencies (like mongoose) won't get installed. After they are installed they can work without the internet connection just fine - if your database is on localhost.
Also, make sure that your local MongoDB server is running. You can run:
mongo test
in the command line to see if you can connect to a local database.
You're in the right path !
Here's the thing, you need to get yourself a copy of MongoDB, you can download and install the suitable version to your system from here.
Now you need to configure MongoDB in your in your path so you can launch it when you is or simply add it a process that will launch when your system starts.
In order to configure please choose the suitable conf to your system :
Windows.
Linux.
macOS.
Then, before running your application, make sure MongoDB is running in the background ad service or daemon and then simply launch your application.

Resources