7/26/2023 0 Comments Nodejs api![]() If it didn’t work, then there might be some problem with your Node installation. If you will run this code using the following command and try to browse to if everything goes right, you will see, says hello printed on your browser screen. Copy the following code in the app.js file. ![]() Let’s start by creating a file called app.js (or index.js) and creating an express server. Perfect now let’s create a new database in mongo and name is “my_db” $ db my_db 3. You can check if MongoDB is installed or not using the following command $ mongo ![]() I am assuming you have already installed MongoDB in your operating system. $ npm install express -save Creating a Database Now, we need to install the Express Js locally in our current project folder. The default main file name will be index.js, but here we have updated it to app.js $ mkdir CURD_using_node $ cd CURD_using_node $ npm initĪfter completing the setup, a file name as package.json will be generated in your current folder. Great, now let’s create an empty directory, and initialize a new app in it. Confirm Node Installationīefore proceeding further, confirm that you have node and npm package already installed in your system using following commands $ node -v $ npm -v 2. I highly recommend checking out this post HTTP request method – REST API verbs to understand them better. If you don’t know about HTTP protocols like the GET, POST, etc. Pre-requisite: I’m assuming that you have a decent knowledge of REST API, Node Js, MongoDB and Express(a NodeJs platform). All the operations such as Create, Update, Read, Delete (CURD) will be done using the REST calls. In this lesson, we are going to design a REST API based applications with NodeJs, Express and MongoDB to create a movie database. ![]()
0 Comments
Leave a Reply. |