🪟 Windows TippsModify Windows Support Phone Number with PowerShell(03.09.2026 um 00:00 Uhr)
🔧 AI Nachrichten Podcast: ChatGPT schwatzt Nutzern in Deutschland jetzt Werbung auf(28.08.2026 um 08:46 Uhr)
🪟 Windows TippsMicrosoft bringt Emoji 17.0 auf Windows 11(31.08.2026 um 08:16 Uhr)
🪟 Windows TippsModify Windows Support Phone Number with PowerShell(03.09.2026 um 00:00 Uhr)
🔧 AI Nachrichten Podcast: ChatGPT schwatzt Nutzern in Deutschland jetzt Werbung auf(28.08.2026 um 08:46 Uhr)
🪟 Windows TippsMicrosoft bringt Emoji 17.0 auf Windows 11(31.08.2026 um 08:16 Uhr)

🔧 Programmierung 🕛 vor 1 Jahr 8 Min Lesezeit
0

CRUD with ExpressJS and MongoDB (Typescript)

↗ Quelle (dev.to)
🗣️ Stimme:
📑 Inhaltsübersicht




Introduction



As a backend developer seeking to create APIs, you'll want to learn about how to store and retrieve data from the database your API works with. Learning all these may seem overwhelming, but, I will show you how to write a CRUD operation API in this article. Before we get our hands dirty, let's talk about some few terms that we need to be clear about.






What is an API?



The full meaning of API is Application Program Interface. An API is simply an interface that can be used by an application program to communicate with a service. E.g, your phone application needs to connect to a service to retrieve information, usually, that service may not be written with the same language your mobile app is written in, so, there need to be an interface which your mobile app can interact with to make the service understand the request that the mobile app is making. That interface is the API and your mobile app is the the program trying to interact with that services' interface.






What is the backend?



The backend comprises of the API, the database, load balancers, process managers and other technologies that enables or enhances the functionality of the service.






What are RESTful APIs?



RESTful means Representational State Transfer and it's a kind of API that ensures stateless interactions with programs using it.



Let me explain: In real life, an example of a stateless transaction would be going to your office without an ID card when the policy at your office demands that you show your ID card before you're allowed into the premises. In this case, even if the gate keeper knows you're an employee, he/she wont still let you in until you show your ID card. And even if you're with your ID card and you step out for just a minute, to get back in to the company's premises you have to show your ID card.



That's exactly how RESTful APIs behave. They don't keep any context/record about your previous interactions with them, once you send a request to a RESTful API and it sends back a response, the connection established when you sent the request is closed. When another request comes in, it's treated as a fresh request (a new connection is established between the program and the server and is closed after the server sends a response).



Some features of RESTful APIs are: HTTP methods, request headers, request payloads, endpoints, response headers, response data, status codes, etc.






Database



A database is simply a server that is dedicated to storing information permanently except the information is being deleted. Your API isn't designed to keep information permanently, so there has to be a place to store it, that's where the database comes in.






MongoDB



MongoDB is coined from the word "humongous", which reflects it's ability to handle large amount of data. It's a schemaless database, which means you can store your data as you like.






Mongoose



You can also use an ODM (Object Document Mapper) like Mongoose to create and appy application level schema. MongoDB stores data as documents, has collections that are made up of documents. Mongoose is an ODM that enables developers query mongodb and also maintain schemas to be used with the database.






CRUD Operations



CRUD stands for Create, Read, Update and Delete. These are the basic operations you'll come across as a backend developer/engineer.






ExpressJS



ExpressJS or Express is a framework that was built to enable developers (like you and I) to build APIs seamlessly.






Let's begin setting up.






Step 1: Initialize a project/package



You initialize a project or package by running the command:




CODE
npm init -y






This will create a package.json file that will be used by npm to manage your project's dependencies.






Step 2: Install the necessary dependencies which are morgan, cors and nodemon



I've already talked about expressjs and mongoose, so let's talk about other dependencies briefly.



is an acronym that means Cross-origin resource sharing, this package/dependency is necessary when you want to restrict which program can interact with your interface and what type of request methods, etc the programs can send to your API.

This is important when your the program and your API are runnng on different platforms or different ports.








Step 9: Open up your terminal and type npm start. This should startup your server automatically. The result should look like this:








Conclusion



This API can be deployed on platforms like render.com , documented on postman and made available to the public if you want to take it to that extent. I hope you learnt about how to conduct CRUD operations using APIs? Hit me up if you have any question/questions.

Vollständiger Original-Bericht
Ausführliche Details, Code-Beispiele & Hersteller-Stellungnahme auf dev.to.
↗ Original-Artikel auf dev.to lesen
Wie bewertest du diesen Beitrag?
1 Klick Feedback
Teilen mit Netzwerk & Team:

Community-Analysen & Experten-Meinungen 0

Verfasse deine eigene Analyse, teile Workarounds oder diskutiere diesen Vorfall im Blog.
Noch keine Community-Analyse verfasst. Markiere einen Textabschnitt oder klicke oben auf Eigene Analyse verfassen“!
Community Pulse: Relevanz-Einschätzung
1 Klick Experten-Votum
🔴 Akute Relevanz 0%
🟡 In Evaluierung 0%
🟢 Keine Auswirkung 0%
Spannende Innovation 0%
Verwandte Story-Cluster & Quellen (Vektor-KI)
Port 8095 Engine
1 Quelle
Modify Windows Support Phone Number with PowerShell
1 Quelle
Die Zukunft des Einkaufens: Warum wir ein neues Kapitel aufschlagen (und wie du es mitschreiben kannst)
1 Quelle
ZDE Podcast 251: Wie sieht digitales Instore Marketing 2026 aus, Amit Chatterjee?
Ähnliche Beiträge
🔍 Verwandte News

Auch interessante Nachrichten CRUD with ExpressJS and MongoDB (Typescript)

Thematisch verwandte Begriffe: CRUD, with, ExpressJS, MongoDB · 6 Treffer

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...