Example Project on how to build and develop REST API with NodeJS, MongoDB, Redis and Docker
Use the docker-compose
docker-compose up -d
curl --location --request GET 'http://localhost:8080/user/:id'
curl --location --request POST 'http://localhost:8080/user' \
--header 'Content-Type: application/x-www-form-urlencoded' \
--header 'Accept: Application/json' \
--data-urlencode 'username=user' \
--data-urlencode 'email=email@email' \
--data-urlencode 'password=password' \
--data-urlencode 'accountNumber=123' \
--data-urlencode 'identityNumber=456'
curl --location --request PUT 'http://localhost:8080/user/:id' \
--header 'Content-Type: application/x-www-form-urlencoded' \
--header 'Accept: Application/json' \
--data-urlencode 'username=newUsername' \
--data-urlencode 'email=newemal@email' \
--data-urlencode 'password=newPassword'
curl --location --request DELETE 'http://localhost:8080/user/:id'
curl --location --request GET 'http://localhost:8080/getAllUserByAccountNumber' \
--header 'Content-Type: application/x-www-form-urlencoded' \
--data-urlencode 'accountNumber=123'
curl --location --request GET 'http://localhost:8080/getAllUserByIdentityNumber' \
--header 'Content-Type: application/x-www-form-urlencoded' \
--data-urlencode 'identityNumber=123'
curl --location --request POST 'http://localhost:8080/login' \
--header 'Content-Type: application/x-www-form-urlencoded' \
--data-urlencode 'username=test' \
--data-urlencode 'password=a'
curl --location --request GET 'http://localhost:8080/protectedPage' \
--header 'x-access-token: <TOKEN>'