Skip to content

Agaber90/GoCleanArchitecture

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

32 Commits
 
 
 
 

Repository files navigation

Screenshot using Golang with clean architecture

This a Golang project to start take a screenshot form URLS using pdfcrowd API and save the images data to mysql database before start to explain this porject please

install the following packages


  1. go get github.com/go-sql-driver/mysql
  2. go get github.com/labstack/echo
  3. go get -u github.com/spf13/viper
  4. go get github.com/pdfcrowd/pdfcrowd-go

First of all let me speak about the solution architecture, the used is clean architecture with dependency injection.

This architecture has 4 layers

  1. models
  2. imagehandler
  3. middleware
  4. imagehttphandler

Model layer

Model layer is reposable to create a structs for our models the to be transfered to the database or bind the requet into it.

imagehandler

This contains the repositoris as well as the business logig, this divided into two folders, one called usecase that will handle all the busines logic, and the last one is called repository to handle the database operation

middleware

This is to handle the crossorigin on the http request

imagehttphandler

This is responsable to create the http request, this would take the a list of URLS then start to screenshot the urls and the image to the folder path, that would be add to the config.json file

In this case I am using three packages

  1. go get github.com/labstack/echo
  2. go get -u github.com/spf13/viper
  3. go get github.com/pdfcrowd/pdfcrowd-go
# echo

why echo, because this is provide a high performance, extensible, minimalist for a go web framework/p>

for more information please check this url : https://echo.labstack.com/

viber

This helo to read the value form the configuration file for more info please check this url : https://github.com/spf13/viper

pdfcrowd

This API will help us to take the URL and convert it to imagem and unfortunately this is not free I am using a trial

After the screen have been taken, I moved it to a shared path folder with a UUID to create a unique name for the screenshot image, and then the Image data will be saved to the database, such as folder path and the creation time to the database.

About

This a Golang project to start take a screenshot form URLS using pdfcrowd API and save the images data to mysql database

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published