![]() The first thing is to select the request type as POST, and use the following url (don’t forget to change to your own. To create a game, we need to make a post request and send a Json object in the request’s body. In this section I’m gonna show you how to use our API to create, edit, read, delete and from game collection. Postman is a HTTP client used for testing APIs. If we take a look on the Put and Delete methods, we see this behavior happening. One thing to point out, there are some actions receiving the id as a string instead of a ObjectId, because is more practical to send just the string that ObjectId generates and create the ObjectId in the back-end code. The file has comments, such as, // GET: api/Game, this is to show how can we make a request to a certain method on the API. ![]() Through a command line tool - the mongo shell. This interface is very similar to MongoDB Compass. Through your web browser and the MongoDB Atlas web user interface. Since it’s a RestAPI, we have all actions needed, like, Get, Post, Put and Delete. Building a REST API with Express, Node, and MongoDB. Through the official cross-platform graphical user interface for MongoDB, Compass. We’re using all methods created on the repository to query and execute actions in the database. Public class GameRepository : IGameRepository
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |