I am confuse that how to create basic CRUD in angular with mongoDB. i install mongodb and create database but i don't know where is my database created. How can i connect my DB with angular 6 and how can i INSERT , UPDATE and DELETE record. other confusion is about models . where is model created and how to call that models in order to interact with db. i am very beginner in Angular 6 and mongoDB. Please guide me step by step. i searched a lots but not find something valuable.
Answers and suggestion will be highly appreciated.
thanks
You can't connect directly any DB and can't do CRUD operation with angular. If you achieve CRUD in angular you need to create API in any server-side language such as PHP,.net, java, node.js and any other. After that, you can call API using HttpClient and achieve CRUD functionality. You can learn more to Clik here to learn HttPClient method for calling API
Related
I want to create a Flutter mobile application and I want to use MongoDB Atlas as a database. Is there a Flutter package available that can help me with that?
If not, is there any other way I can connect Flutter to a MongoDB Atlas Database? If there isn't, what other options do you suggest?
Thank you in advance.
you can use the package mongo_dart, here is the catch in the database URL give URL to your MongoDB atlas database and you will be able to perform all the crud operations as usual. The documentation is pretty well written so you wouldn't have to face any pro
As #JideGuru said, what you'll want is some form of API that you can then make requests to from your app.
i.e. Instead of accessing your DB directly, you'd do something in Flutter like http.get("yourserveraddress.com/getSomethingWithThisNumber/1") using the HTTP package.
I'd recommend looking at something like Node.JS (https://nodejs.org/), which is a runtime for Javascript that allows it to be ran on servers. I'm just getting started with it and for basic CRUD (Create, read, update, delete) operations on my SQL database its been perfect. I'm not a JS developer by any stretch, but it is easy enough to pick up.
You really should never have your database being directly accessed by a client, as that means leaving it exposed on the internet!
MongoDB have their own driver for NodeJS, I've used it with atlas and it seems solid.
(https://mongodb.github.io/node-mongodb-native/)
Hope this helps!
I was wondering if anyone had a good solution to using both ASP.NET Core 3 Identity and IdentityServer4 with MongoDb as the backend. I've had some success with the MongoDb QuickStart example for MongoDb. Unfortunately it uses TestUsers in memory.
Any help would be greatly appreciated.
To use users from MongoDB with IdentityServer4, you need to implement IProfileService as per this document
I have an angular website that needs to show data from a postgresql database.
Is there a way to do it natively within angular or do i have to use an ORM? If ORM needs to be used, any suggestions on the one that can run a long query and return results than just GetAll()?
Thanks in advance!
Angular is front-end technology that has no native way to access your database. You'll need some server side technology that returns JSON from your PostgreSQL database in order to access it from Angular.
This is a decent resource to get you headed in the right direction: https://scotch.io/tutorials/creating-an-angularjs-application-with-sequelize-part-1
In 'first hand' experience I recommending sequelize-typescript as the way to go.
Good luck!
I have a number of tables inside a database that I use for 4-5 different websites. These tables already exist and have plenty of data and views/stored procedures/functions etc. already completed.
I would like to provide an api to give access to each of these tables to whichever website I happen to be using so they're accessing the data in a consistent manner. I have Visual Studio 2015 and have been trying to create a Web Api using EntityFramework.
However, every tutorial I find for accessing databases insists on creating the database and tables within the code for the api, and utilizes just the tables with the various CRUD actions handled within.
As I have the tables built, I don't want to recreate them, and as I have some programming already in place using functions/stored procs, I don't really want to reinvent the wheel and recreate it all.
I did find this: http://www.c-sharpcorner.com/UploadFile/4b0136/working-with-stored-procedures-using-entity-framework-part/ for EF6 (though I believe I'm using EF7, but that seems to be importing each function in turn, which seems.. kludgy)
So my question is two-fold:
Is ASP.NET 5 web api the right tool for the job?
Can the ASP.NET 5 web api handle stored procedures easily?
At time of writing it's currently easier to build an API over an existing database using ASP.NET 4.6 and EF 6. This tutorial describes how you can go about building a model from an existing database:
http://www.asp.net/mvc/overview/getting-started/database-first-development/creating-the-web-application
Once you have a model and your classes in place, you can then follow any article on scaffolding Web API.
I followed very simple example from www.asp.net to create Web API project using Empty project template for Web API. This tutorial does not create database instead it just create model class and seed data inside api controller.
I successfully consumed API controller using angular service and able to show data on UI. Till here everything is fine.
However, moving one step further i would like create database but not sure about the steps.
I don't want to follow some other tutorial available on same site which does all of these things because i am not understand the overall concept even though i'll able to create database. Also, tutorial talks about using MVC approach which i dont want to use. I just looking for Web API, EF and Angular combination.
Can someone guide me for writing context class and overall database creation steps.?