GithubHelp home page GithubHelp logo

companyinformation's Introduction

Company Information API


Option 1: start on local

  • Type mvn spring-boot:run to launch Rest API.
  • Or you can type mvn clean package to generate a JAR file and then start server with java -jar path/to/jar/file (Normally in inside /target/)

Option 2: Start by Docker and AWS serverless Postgresql DB

  • Example using AWS Serverless Postgresql DB with docker container
docker build -t department-app .
docker run -d -p 8090:8090 department-app
docker stop <imageID>  #if you want to stop
  • in properties.yml file
spring:
  datasource:
    url: jdbc:postgresql://food-tech.cfaqce9zt6sm.eu-central-1.rds.amazonaws.com:5432/postgres
    username: postgres
    password: burhanorkun

Option 3: Start by Docker Compose with Postgresql docker image

  • Launch the Postgresql DB Docker image and our Java application with 2 different docker images.
docker-compose up -d
docker-compose down   #if you want to stop

this is docker-compose yml file;

version: '3.8'
services:
  app:
    build:
      context: .
      dockerfile: Dockerfile
    depends_on:
      - db
    ports:
      - "8090:8090"
    environment:
      SPRING_DATASOURCE_URL: jdbc:postgresql://db:5432/postgres
      SPRING_DATASOURCE_USERNAME: postgres
      SPRING_DATASOURCE_PASSWORD: burhanorkun
  db:
    image: postgres
    restart: always
    environment:
      POSTGRES_PASSWORD: burhanorkun
      POSTGRES_USER: postgres
      POSTGRES_DB: postgres
    ports:
      - "5432:5432"
    volumes:
      - postgres-data:/var/lib/postgresql/data

volumes:
  postgres-data:

TODO-LIST

  • Department and Employee information API for Company
    • Entity Class
    • Repositories
    • Services
    • Controllers
    • Docker
    • Docker Compose
    • Authentication and Authorization implementation (JWT or OAuth or SAML)
    • Swagger Implementation
    • Terraform for AWS Beanstalk
    • Deploy with CI/CD automation

Optional

  • add HATEOAS
  • Alias domain (DNS)

Examples

Rest API Test Sets for Insomnia; Foottec_Insomnia_test_set.yaml

Examples;
localhost:8090/api/v1/employees
localhost:8090/api/v1/employees/{id}
localhost:8090/api/v1/departments
localhost:8090/api/v1/departments/{id}

# get employees 
curl http://localhost:8090/api/v1/employees  
[{"id":5,"name":"Erkan","email":"[email protected]","department":{"id":2,"name":"VAS","description":"Value Added Services"}},{"id":1,"name":"Burhan Orkun","email":"[email protected]","department":{"id":1,"name":"CRM","description":"Customer Relation Management2"}}]  
# findById employee
curl http://localhost:8090/api/v1/employees/5
{"id":5,"name":"Erkan","email":"[email protected]","department":{"id":2,"name":"VAS","description":"Value Added Services"}}
# post employee
curl -H "Content-Type: application/json" http://localhost:8090/api/v1/employees -d '{"name": "Cem","email": "[email protected]","department": {"id": 2}}'
{"id":32,"name":"Cem","email":"[email protected]","department":{"id":2,"name":"VAS","description":"Value Added Services"}}
# delete employee 
curl -XDELETE http://localhost:8090/api/v1/employees/3

# get department 
curl http://localhost:8090/api/v1/departments
[{"id":1,"name":"CRM","description":"Customer Relation Management2"},{"id":2,"name":"VAS","description":"Value Added Services"},{"id":17,"name":"IT","description":"Information Technology"}]%
# findById department
curl http://localhost:8090/api/v1/department/1
{"id":1,"name":"CRM","description":"Customer Relation Management2"}
# post department
curl -H "Content-Type: application/json" http://localhost:8090/api/v1/department -d '{"name": "CRM","description": "CRM desc"}'
{"name": "CRM","description": "CRM desc"}
# delete department 
curl -XDELETE http://localhost:8090/api/v1/department/3

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.