GithubHelp home page GithubHelp logo

nikby53 / image-converter Goto Github PK

View Code? Open in Web Editor NEW
4.0 1.0 1.0 2.25 MB

Service that expose a RESTful API to convert JPEG to PNG and vice versa and compress the image with the compression ratio specified by the user.

License: Apache License 2.0

Dockerfile 0.32% Makefile 0.51% Go 99.03% Shell 0.15%
go golang rest-api golang-api docker docker-compose jwt-authentication aws-s3 minio cli

image-converter's Introduction

Image-converter

Service that expose a RESTful API to convert JPEG to PNG and vice versa and compress the image with the compression ratio specified by the user. The user has the ability to view the history and status of their requests (queued, processed, completed) and download the original image and the processed one.

Build & Run (Locally)

Prerequisites

  • go 1.16
  • docker
  • golangci-lint (optional, used to run code checks)
  • aws access and secret key

Create .env file in root directory and add following values:

API_PORT=

DB_USERNAME=
DB_PASSWORD=
DB_NAME=
DB_HOST=
DB_PORT=
DB_SSL_MODE=

AWS_BUCKET_NAME=
AWS_ACC_ID=
AWS_SECRET_KEY=
AWS_REGION=

MINIO_BUCKET_NAME=
MINIO_ACC_ID=
MINIO_SECRET_KEY=
MINIO_REGION=
MINIO_ENDPOINT=

JWT_SIGNING_KEY=
JWT_TOKEN_TTL=

Use make run to build&run project, make lint to check code with linter.

Architecture Diagram

Entity–relationship model

Endpoints

  • /auth/signup - user registration [POST]
  • /auth/login - user authorization [POST]
  • /image/convert - convert and compress image [POST]
  • /image/download/{id} - downloads needed image [GET]
  • /requests - get the user's requests history [GET]

Run image converter from a binary command line interface

Grab a binary from releases page

image-converter's People

Contributors

nikby53 avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar

Forkers

heartshare

image-converter's Issues

Implement atomacity in ACID pattern for application

The idea is to break transactions if one of them failed.

This can be useful:

func (db *DB) Transactional(ctx context.Context, f func(s cts.Service) error) error {
	sqlDB, ok := db.conn.(*sqlx.DB)
	if !ok {
		return errors.New("couldn't bring to DB")
	}
	tx, err := sqlDB.BeginTxx(ctx, &sql.TxOptions{})
	if err != nil {
		return errors.New("couldn't start transaction")
	}
	defer func() {
		if err != nil {
			tx.Rollback()
			return
		}
		err = tx.Commit()
	}()
	return f(&DB{conn: tx})
}

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.