Git Product home page Git Product logo

incode-group-test's Introduction

Simple User Management RESTful API This project implements a simple RESTful API in Java using Spring Boot to manage users. It provides endpoints to perform CRUD operations on user entities.

API Endpoints The following API endpoints are available:

  1. GET /api/users: List all users.
  2. GET /api/users/{id}: Get a single user by ID.
  3. POST /api/users: Create a new user.
  4. PUT /api/users: Update an existing user.
  5. DELETE /api/users/{id}: Delete a user.

User Entity The User entity has the following fields:

  • id: Unique identifier of the user.
  • name: Name of the user.
  • email: Email address of the user.
  • password: Password of the user.

Build and Run Instructions To build and run the project, follow these steps:

  1. Ensure you have Java 11, Maven, Docker, and Docker Compose installed on your system.
  2. Clone the project repository.
  3. Navigate to the project root directory.
  4. Run command docker compose up -d

The API will be available at http://localhost:8080/api/users.

Assumptions and Decisions

  • The application uses MongoDB as the database for storing user data. The Docker Compose configuration includes a MongoDB service.
  • The User entity has basic fields for id, name, email and password. Additional fields can be added as per requirements.
  • Error handling and validation have been implemented to handle invalid requests and provide appropriate responses.
  • Testing with JUnit has been implementedt to ensure the correctness of the implemented functionality.
  • I decided not to include the user ID in the PUT update API as a path variable, since it is present in the request body.
  • Also, I haven't worked with mongo db at all before, so I'm not sure about the best practice of doing the repository level.

Clean Code Principles In this project, clean code principles such as readability, maintainability, and DRY (Don't Repeat Yourself) have been followed. Some notable practices include:

  1. Using meaningful variable and method names to enhance code readability.
  2. Breaking down complex logic into smaller, reusable methods for maintainability.
  3. Proper Indentation and Formatting.
  4. Avoid Magic Numbers and Magic Strings.

incode-group-test's People

Contributors

yaroslavyarmoshyk 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.