Git Product home page Git Product logo

users-api's Introduction

User API

Goal

The goal of this project is to create a User CRUD API. It allows users to perform basic CRUD operations (Create, Read, Update, Delete) on user data. You first need to register and then authenticate to be able to Read Update and Delete

Architecture

This project follows a clean architecture approach with a pragmatic twist. It separates concerns into different layers, such as the application layer, business logic (domain) layer, and data access layer. This architecture promotes modularity, testability, and maintainability.

Getting Started

To start the project, follow these steps:

  1. Install the required dependencies by running the following command:

    npm install
    
  2. Start the API server by running the following command:

    npm run start
    
  3. The API server will start running on a specified port. You can access it using the provided URL.

Authentication

This project uses token-based authentication. To obtain a token, follow these steps:

  1. Register by sending a POST request to the /register route with your email and password.

  2. Log in by sending a POST request to the /login route with your email and password. The response will include an x-api-key header containing the token.

  3. Include the x-api-key token in the headers of subsequent requests to authenticate and authorize your operations.

Note: Make sure to keep your token secure and do not share it with others.

Environment Variables

This project utilizes environment variables for configuration. Here are the required variables:

  • API_TOKEN: The apiKey to do the operations

Make sure to set these variables before starting the API server.

There is a .env.dist that has the keys important for this project you can copy it and rename it to .env

Running Tests

To run the tests for this project, use the following command:

Documentation

The project includes a /doc folder that contains the Postman configuration. You can import this configuration into Postman to easily test the API endpoints and explore the available requests. Here's the process to import in Postman

users-api's People

Contributors

fabr9193 avatar

Watchers

 avatar

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.