Giter VIP home page Giter VIP logo

employee-rest-api's Introduction

  • Employee's Rest API

Overview:

This API consists of a simple employee management application, containing information about first name, last name, and email. It is possible to perform all CRUD operations (Create, Read, Update, and Delete) on the database through the endpoints.

The main focus of this API is to develop skills in back-end structure development using the Spring Boot framework, including clean code best practices, SOLID principles, layer pattern, and unit and integration testing.


Tools:

  • Java 17;
  • Spring Boot;
  • MySQL;
  • Maven;

Available methods:

HTTP Methods Path Resource(Type) Response
GET /api/v1/employees List of Employees
GET /api/v1/employees/ id (integer) Employee Json body
GET /api/v1/employees/first-name?name= name (string) Employee Json body
POST /api/v1/employees Employee Json body
PUT /api/v1/employees/ id (integer) Employee Json body
DELETE /api/v1/employees/ id (integer) Delete message

- Examples:

  1. Get a list of all employees:
  http://localhost:8080/api/v1/employees
  1. Get employee by id (e.g. id = 1):
  http://localhost:8080/api/v1/employees/1
  1. Get employee by first name (e.g. name = "John"):
  http://localhost:8080/api/v1/employees/first-name?name=John
  1. Add new employee:
  http://localhost:8080/api/v1/employees
  
  Request json body:
  
  {
    "firstName": "Carl",
    "lastName": "Sagan",
    "email": "[email protected]"
  }
  1. Update existing employee (e.g. id = 1):
  http://localhost:8080/api/v1/employees/1
  
  Request json body:
  
  {
    "firstName": "Carl",
    "lastName": "Sagan",
    "email": "[email protected]"
  }
  1. Delete existing employee (e.g. id = 1):
  http://localhost:8080/api/v1/employees/1
  
  Response:
  
  Employee Carl Sagan was deleted.



Setup:

  1. Go to the directory that you would like to clone the repository;
  2. Clone the repository and create a local copy following the command above:
  git clone https://github.com/Lukasveiga/employee-rest-api.git
  1. Insert que file application.properties in the resources folder in the main directory with the following spring configuration to setup the MySQL database:
 spring.datasource.url=jdbc:mysql://localhost:3306/{database}
 spring.datasource.username={username}
 spring.datasource.password={password}

Replace {database} with the database name, {username} with username and {password} with password without the {}.

  1. And run with IDE of your choice or maven command lines.

Autor:

employee-rest-api's People

Contributors

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