HUB
Sign inSign up

mharidy/api

By mharidy

•Updated over 6 years ago

Students API beuth

Image
0

1.3K

mharidy/api repository overview

Docker

1- docker pull mharidy/api -> to download the last version, or docker pull mharidy/api:TAG for a specific version

2-docker run -p 27017:27017 -v mongodbdata:/data/db --name mongoAPI mharidy/api:latest —> to run it or replace :latest with the same pulled :TAG

3- docker container ps -a -> To get list of the containers

4- docker start mongoAPI_CONTAINER_ID

5-** docker ps** to get a list of running docker containers

6- Run the node.js server and add an element to a collection -> node app.js

7- send Get request to http://localhost/api/v1/Customer⁠ using postman to make sure that it’s added, you can also try to post a new customer

8- check if they added to the DB or not -> docker exec -it mongoAPI_CONTAINER_ID(from docker ps) bash

9- you will enter the container then ->** mongo **(so you will enter the mongo image) then ->show dbs (you will get a list all databases) you should find a database called ourCreatedDatabase -> use ourCreatedDatabase (to use the db) -> db.customers.find({}) (now you will get a list of saved customers)

10- to save the changes to the image -> docker commit -m "Commit message" mongoAPI_CONTAINER_ID mharidy/api:TAG

11- **docker push mharidy/api:TAG —> to upload your changes to our docker-repository **

Congratulations you just updated out mongoDB image :D

Tag summary
Recent tags
Content type
Image
Digest
Size
157.1 MB
Last updated
over 6 years ago
docker pull mharidy/api:latest