for practice
- basic command for start:
$ npm init -y
- init ial packages:
$ npm i express $ npm i -D nodemon
- rest api
- server creat
- models, middlewares,routers,controllers
- databse connectivity
- mongodb
- post,get
https://nodejs-server-making.mitalsapkale1.repl.co/api/v1/userinfo
https://nodejs-server-making.mitalsapkale1.repl.co
API methods such as POST, PUT, GET, and DELETE (commonly referred to as CRUD operations) are used to perform different actions on resources in a web API. Each method serves a specific purpose and is used in different scenarios:
-
POST (Create): The POST method is used to create a new resource on the server. When making a POST request, you send data to the server to create a new record or entity. For example, you might use a POST request to create a new user, add a new product to a catalog, or submit a form.
-
GET (Read): The GET method is used to retrieve or read data from the server. It is the most commonly used method and is used to fetch existing resources. When making a GET request, you typically include parameters in the URL to specify the resource you want to retrieve or filter the results. For example, you might use a GET request to retrieve a user's profile, fetch a list of products, or get the details of a specific item.
-
PUT (Update): The PUT method is used to update an existing resource on the server. When making a PUT request, you send data to the server to update an existing record or entity. The entire resource is replaced with the new data provided. For example, you might use a PUT request to update a user's information, modify the details of a product, or edit the contents of a blog post.
-
PATCH (Partial Update): The PATCH method is similar to PUT, but it is used to perform a partial update on a resource. Instead of replacing the entire resource, you send only the changed or updated fields. This method is useful when you want to update specific fields without affecting the others. For example, you might use a PATCH request to update a user's email address or change the status of an order.
-
DELETE (Delete): The DELETE method is used to remove a resource from the server. When making a DELETE request, you specify the resource you want to delete, and the server removes it. For example, you might use a DELETE request to delete a user account, remove a product from inventory, or delete a comment from a post.
These API methods form the foundation for performing basic CRUD operations in a web API, allowing you to create, read, update, and delete resources. They adhere to the principles of Representational State Transfer (REST), which provides a standard and uniform way to interact with resources in a web-based system.