I am trying to connect Angular to MongoDB - node.js

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.

Related

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?

Connecting to external database using React, Nodejs, Express, and PostgreSQL

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?

Full Stack NextJS Application

I created a lot of projects with ReactJS.
Therefore i created a frontend with ReactJS and a backend with express js.
Now i want to switch to NextJS to avoid creating a seperate backend, because NextJS has api routes builded in.
So i created a new NextJS project with npx create-next-app MyProject --ts for typescript support.
The first steps were great because of rendering, routing etc.
But then i wanted to add a local database (mariadb) to fetch data.
In my last projects i used typeorm as ORM witch worked very well on the express js backend.
But i was not able to add typeorm to nextjs. And i didn't find any post which explains how to do it. The only orm which seems to work is prisma. But i don't like the syntax.
So i'm thinking if NextJS is the framework to choose to program applications with local db.
What is your stack to create a web application?
I have use https://massivejs.org/ to connect my fullstack NextJS but with PostgreSQL instead.

Feathersjs frontend and backend in a single project

I'm looking to build a small customer management portal for myself. I've recently started working with node and vuejs a lot (coming from an html/css/javascript background). I've really enjoyed CLI development though and am looking to build a customer management portal (nothing fancy) that has a MySQL backend. After studying frameworks and ideas I found feathersjs which I REALLY like. After a few hours I was able to have a REST api that returns data from my MySQL database and uses authentication. I can get MySQL data in a JSON datasource and even do inserts, updates, deletes. I generated the services and models using the feathersjs CLI generator.
My question is, do I really need to make two separate projects (one for backend and one for a public frontend) and run them each on a node server? Or could I do this in as single project? I'm still learning and reading up on feathersjs but I'm not seeing a way to make this possible. I do see a public folder in my feathersjs project that was generated but I don't know how to utilize it for node (I wanted my frontend written in Vue). I can see how static HTMLfiles would work in this public folder.

Connect to MongoDB remote server with Ionic

I'm trying to develop an application in phonegap/ionic and I want to use a remote database to store my data. I want to use MongoDB.
I already tried lots of ways such as this quick start guide.
By using this I can connect to DB but this is pure node.js and the require() function cannot be recognized when I try to add this code to an ionic starter app. Maybe require is not supported in ionic
Is there a way that can achieve it in Ionic?
Please let me know if you want some more information.
The thing is; you can't connect Ionic to MongoDB directly. No, there's not workaround, no magic involved, it's just not the way this is supposed to work. Ionic works on top of Angular and Angular is a frontend framework.
However, the way you should do it is that you basically create a (RESTful) API on your server side.
Most likely this will be made with Node.js which will talk directly to MongoDB and query it. A framework very well suited for this (you actually may be using it already) is Express.
After you write your (RESTful) API then you can consume it through your services in Angular by using Angular's $resource object.
Sure, this is not a step by step answer, and it seems you're just starting in this area, so you have some learning do to on your part (REST, RESTful, $resource, services...), but I wish you good luck and if you'll have any more specific questions, don't hesitate to ask them.

Resources