auth microservice

Authentication microservice built with Node.js that follows Clean Architecture + TDD + SOLID + DDD + functional programming principles

59
17
TypeScript

Build Status Coverage Status Auth Microservice License


Node.js Authentication Microservice

A simple API built with Node.js that follows Clean Architecture + TDD + SOLID + DDD principles

Table of Contents

About The Project

Built With

Getting Started

to run the project you need to have npm installed on your machine and
the mongo DB

Prerequisites

to get the npm https://www.npmjs.com/get-npm

Installation

  1. Clone the repo
git clone https://github.com/AdilsonFuxe/clean-auth-microservice.git
  1. Server configuration

Enter into the server folder

cd clean-auth-microservice
  1. inside the server folder run the following command to install all dependencies
npm install or yarn
  1. to generate the build of the project run
npm run build or yarn build
  1. to run the server
npm start or yarn start
  1. to run the unit tests and the integration tests
npm test or yarn test

Endpoints


SignUp

POST https:/localhost/api/v1/signup

output example
// POST https:/localhost/api/v1/signup

// Request Body
{
  "firstName": "any_name",
  "lastName": "any_name",
  "email": "[email protected]",
  "password": "any_password",
  "passwordConfirmation": "any_password"
}

// Response Body
{
  "accessToken": "any_access_token"
}

SignIn

POST https:/localhost/api/v1/signin

output example
// POST https:/localhost/api/v1/signin

// Request Body
{
  "email": "[email protected]",
  "password": "any_password"
}

// Response Body
{
  "accessToken": "any_access_token"
}

Me

GET https:/localhost/api/v1/me

output example
// Get https:/localhost/api/v1/me
// HEADER x-access-token = any_access_token

// Response Body
{
  "id": "any_id",
  "firstName": "any_name",
  "lastName": "any_name",
  "email": "[email protected]"
}

Forgot Password

Patch https:/localhost/api/v1/forgot

output example
// Patch https:/localhost/api/v1/forgot

// Request Body
{
  "email": "[email protected]"
}

Reset Password

Patch https:/localhost/api/v1/reset-password

output example
// Patch https:/localhost/api/v1/reset-password

// Request Body
{
  "email": "[email protected]",
  "accessToken": 092498,
  "password": "new_password"
}

Signout

Delete https:/localhost/api/v1/signout

output example
// Delete https:/localhost/api/v1/signout
// HEADER x-access-token = any_access_token

// Request Body
Status Code 204
{}