an architectural style for an API that uses HTTP requests to access and use data
REpresentational State Transfer is the architectural design of APIs. What do I mean by that? It’s a protocol that contains several rules. An API has to meet all all the conditions to be a RESTful API. We will discuss these rules just in a minute on this article. Before we do that, keep in mind that REST is not the only architectural style for APIs. There are many other concepts such as GraphQL and Soap.
use mongoose with node.js to make things easier for MongoDB
First of all you should have installed MongoDB and be able to run it before you install mongoose. You can read this article to see how to do that on Mac.
In order to install mongoose, we’ll use npm command in the project folder. But first, you should go to the relevant project folder in command line.
Hint: You can use cd command to change directories in command line. (ex: cd Desktop)
npm i mongoose
Once that’s done, we can go over to the next step…
How to use mongo shell in command line
If you haven’t installed MongoDB, or you want to check if it is running, you can read the previous article before reading this one.
After the installation, while MongoDB is running, you should be able to access mongo shell by just typing mongo in command line.
Now, you should see “>” character in the beginning of the row.
In mongo shell you can type “help” to see some most common commands.
2. Help Command:
A brief introduction to install and setup MongoDB.
In order to install MongoDB on your Mac, you should first install HomeBrew which is a package manager for Mac OS.
You can check if brew is already installed on your computer with this command in terminal:
If you can’t see any version of brew you should install it. The following code snippets are terminal commands.
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"
2. Find the MongoDB tab
brew tap mongodb/brew
3. Install MongoDB
brew install mongodb-community
Now that you installed MongoDB you can create the db folder.