Giter Club home page Giter Club logo

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>'

Aswita Hidayat's Projects

deployer icon deployer

A deployment tool written in PHP with support for popular frameworks out of the box

prima icon prima

Laravel 5.4 and Vue 2 Framework

taxonomy-dropdown-widget icon 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.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.