This is just a minimalist API on which I implemented the CRUD on course management.
With this API you will be able to:
- Create a course
- Read one or more courses
- Update a course
- Delete a course
-
Install
nodejsif you don't have it installed. If you are not sure, check it in theterminal, by typing type$ node -vor$ npm -v. -
Clone the project from the terminal (type
$ git clone https://github.com/Domeshow/Nodejs-CRUD-API) or you can download a ZIP file -
Open the main directory of the project then type in the
terminalthe command below:
npm install
This should install all the dependancies of the project.
-
Go to Mongodb Platform and create a new cluster (create first an account if you don't have it). Note that you can use a local database using MongoDB Compass
-
Copy your connection string (You will use it to connect to your database).
-
Create a
.envon the root of the project following the.env-examplefile and put required informations there# The port you want to use. By default is se to '3800' ... "PORT": "root", # The connection string of your database. By default it is set to ''(empty) "DB_URL": "The connection string you copied"
- Go back again in the
terminaland type the command below to run theAPI Server
npm start
-
Then open an
API tester application(for exemplePostman) and test.Note: the base url for testing
Endpointsishttp://localhost:3800/api/if the PORT still by default. You have just to add the method to call the API. for exemple to retrieve a course by his id you shoud send a GET request to theEndpointhttp://localhost:3800/api/courseIdHere
Coming soon...