Skip to content
View aswitahidayat's full-sized avatar

Block or report aswitahidayat

Block user

Prevent this user from interacting with your repositories and sending you notifications. Learn more about blocking users.

You must be logged in to block users.

Please don't include any personal information such as legal names or email addresses. Maximum 100 characters, markdown supported. This note will be visible to only you.
Report abuse

Contact GitHub support about this user’s behavior. Learn more about reporting abuse.

Report abuse
aswitahidayat/README.md

nodejs-restapi-mongo-redis-docker

Example Project on how to build and develop REST API with NodeJS, MongoDB, Redis and Docker

INSTALLATION

Use the docker-compose

docker-compose up -d

REST API

User CRUD

GET

curl --location --request GET 'http://localhost:8080/user/:id'

CREATE

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'

UPDATE

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'

DELETE

curl --location --request DELETE 'http://localhost:8080/user/:id'

GET USERS BY ACCOUNT NUMBER

curl --location --request GET 'http://localhost:8080/getAllUserByAccountNumber' \
--header 'Content-Type: application/x-www-form-urlencoded' \
--data-urlencode 'accountNumber=123'

GET USERS BY IDENTITY NUMBER

curl --location --request GET 'http://localhost:8080/getAllUserByIdentityNumber' \
--header 'Content-Type: application/x-www-form-urlencoded' \
--data-urlencode 'identityNumber=123'

AUTHENTICATION

LOGIN

curl --location --request POST 'http://localhost:8080/login' \
--header 'Content-Type: application/x-www-form-urlencoded' \
--data-urlencode 'username=test' \
--data-urlencode 'password=a'

PROTECTED PAGE

curl --location --request GET 'http://localhost:8080/protectedPage' \
--header 'x-access-token: <TOKEN>'

Popular repositories Loading

  1. ujianDataSience ujianDataSience Public

    Jupyter Notebook 1

  2. namakota namakota Public

    PHP

  3. phpindonesia.or.id-membership2 phpindonesia.or.id-membership2 Public

    Forked from phpindonesia/phpindonesia.or.id-membership2

    PHP Indonesia - Membership Application - Reloaded

    PHP

  4. www.phpindonesia.or.id www.phpindonesia.or.id Public

    Forked from phpindonesia/www.phpindonesia.or.id

    Website Resmi PHP Indonesia Community

    JavaScript

  5. sewania sewania Public

    PHP

  6. Taxonomy-Dropdown-Widget Taxonomy-Dropdown-Widget Public

    Forked from ethitter/Taxonomy-Dropdown-Widget

    Creates a dropdown list of non-hierarchical taxonomies as an alternative to the term (tag) cloud. Formerly known as Tag Dropdown Widget.

    PHP