GithubHelp home page GithubHelp logo

vikas-gautam / employee-api Goto Github PK

View Code? Open in Web Editor NEW

This project forked from ot-microservices/employee-api

0.0 0.0 0.0 299 KB

A Golang based web microservice for handling all employee related data

License: Apache License 2.0

Go 96.31% Makefile 2.11% Dockerfile 1.59%

employee-api's Introduction

Employee REST API is a golang based microservice which is responsible for all the employee related transactions in the OT-Microservices. This application is completely platform independent and can be run on any kind of platform.

Supported features in the applications are:-

  • Gin REST API for web transactions
  • ScyllaDB as primary database for storing information
  • Redis as a cache management system for quick response
  • Swagger integration for the documentation of the API
  • Prometheus's metrics support to monitor application health and performance

Pre-Requisites

The application doesn't have any specific pre-requisites except the database connectivity. Additionally, we can add Redis as cache system but it's not part of the mandatory setup.

For running the application, we need following things configured:

Architecture

Application

For building the application, we can use make command. The same command can be used to build docker image as well.

make build
make docker-build

For execution of the unit test cases, code coverage reports, etc. We can use go test command.

go test $(go list ./... | grep -v docs | grep -v model | grep -v main.go) -coverprofile cover.out
# For HTML report visualization
go tool cover -html=cover.out

The test cases are covered for only these packages:-

  • api
  • client
  • config
  • middleware
  • routes

For dev testing, the Swagger UI can be used for sample payload generation and requests. The swagger page will be accessible on http://localhost:8080/swagger/index.html

To run the application, simple binary commands can be used. Before running the application, we have to make sure our mandatory database (ScyllaDB) is up and running. Configuration properties will be configured inside config.yaml file. Also, once the property file is defined and configured properly, we need to run migrations to create database, schema etc. The connection details for migration is available in migration.json.

make run-migrations

Once the keyspace and table is initialized, we can run the application by:

export GIN_MODE=release
# For debugging set gin mode to development
./employee-api

Endpoints Information

Endpoint Method Description
/metrics GET Application healthcheck and performance metrics are available on this endpoint
/api/v1/employee/health GET Endpoint for providing shallow healthcheck information about application health and readiness
/api/v1/employee/health/detail GET Endpoint for providing detailed health check about dependencies as well like - ScyllaDB and Redis
/api/v1/employee/create POST Data creation endpoint which accepts certain JSON body to add employee information in database
/api/v1/employee/search GET Endpoint for searching data information using the params in the URL
/api/v1/employee/search/all GET Endpoint for searching all information across the system
/api/v1/employee/search/location GET Application endpoint for getting the count and information of location
/api/v1/employee/search/designation GET Application endpoint for getting the count and information of designation
/swagger/index.html GET Swagger endpoint for the application API documentation and their data models

Contact Information

Opstree Opensource

employee-api's People

Contributors

iamabhishek-dubey 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.