Skip to content

Test task for the backend internship position in the Doodocs company

Notifications You must be signed in to change notification settings

fallen-fatalist/zip-api

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

24 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Zip api

This is a web application for processing zip archives

the main features:

  1. To get info about zip archive
  2. To archive the files into zip archive
  3. Send files to specified emails

API

  1. Get info about archive:
POST /api/archive/information HTTP/1.1
Content-Type: multipart/form-data; boundary=-{some-random-boundary}

-{some-random-boundary}
Content-Disposition: form-data; name="file"; filename="my_archive.zip"
Content-Type: application/zip

{Binary data of ZIP file}
-{some-random-boundary}--
  1. Archive files into zip archive
POST /api/archive/files HTTP/1.1
Content-Type: multipart/form-data; boundary=-{some-random-boundary}

-{some-random-boundary}
Content-Disposition: form-data; name="files[]"; filename="document.docx"
Content-Type: application/vnd.openxmlformats-officedocument.wordprocessingml.document

{Binary data of file}
-{some-random-boundary}
Content-Disposition: form-data; name="files[]"; filename="avatar.png"
Content-Type: image/png

{Binary data of file}
-{some-random-boundary}--
  1. Send the file to the email
POST /api/archive/files HTTP/1.1
Content-Type: multipart/form-data; boundary=-{some-random-boundary}

-{some-random-boundary}
Content-Disposition: form-data; name="files[]"; filename="document.docx"
Content-Type: application/vnd.openxmlformats-officedocument.wordprocessingml.document

{Binary data of file}
-{some-random-boundary}
Content-Disposition: form-data; name="files[]"; filename="avatar.png"
Content-Type: image/png

{Binary data of file}
-{some-random-boundary}--

How to up?

Clone the repository

git clone https://github.com/fallen-fatalist/zip-api

Run the main function

go run main.go

Configuration

  • The application can launch the application in the specific port\for that purpose set "PORT" environment variable to desired port.

  • The application can set the maximum size of the request body\ for that purpose set "BODYLIMIT" environment variable to desired body limit in bytes.

Progress

  • Router

  • Archive information

    • Archive information controller
    • Archive information service
    • Added docx signature and XML mimetype changing
  • Archive formation

    • Archive files service
    • Archive files controller
    • Divide service and controller
  • Move validation from controllers to services

  • Email

    • SMTP sender
    • Mail credentials env variables
    • Email controller

About

Test task for the backend internship position in the Doodocs company

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages