# README
doodocs-days-backend
Terms of reference from doodocs for an internship in the backend
📝 Table of Contents
🧐 About
RESP API for zipping/unzipping files and sending archives via SMTP.
🏁 Getting Started
These instructions will get you a copy of the project up and running on your local machine for development and testing purposes.
Prerequisites
go version 1.21+
Installing
A step by step series of examples that tell you how to get a development env running.
Setup the environment variables
$env:DOODOCS_DAYS2_BACKEND_AUTH_USERNAME = "USERNAME_FOR_MIDDLEWARE_REQUEST"
$env:DOODOCS_DAYS2_BACKEND_AUTH_PASSWORD = "PASSWORD_FOR_MIDDLEWARE_REQUEST"
$env:DOODOCS_DAYS2_BACKEND_MAIL_USERNAME = "USERNAME_FOR_SMTP_REQUEST"
$env:DOODOCS_DAYS2_BACKEND_MAIL_PASSWORD = "APP_PASSWORD_FOR_SMTP_REQUEST"
Build the project
go build -o server ./cmd/main.go
Run it
./server
🔧 Running the tests
Break down into end to end tests
And coding style tests
🎈 Usage
$ ./server --help
Doodocs days-2 backend project
Usage:
server [--port <N>] [--dir [S]]
server --help
Options:
--help Show this screen.
--porn N Port number.
--dir S Path to the data directory.
REST API Endpoints:
Request
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}--
Responce
HTTP/1.1 200 OK
Content-Type: application/json
{
"filename": "my_archive.zip",
"archive_size": 4102029.312,
"total_size": 6836715.52,
"total_files": 2,
"files": [
{
"file_path": "photo.jpg",
"size": 2516582.4,
"mimetype": "image/jpeg"
},
{
"file_path": "directory/document.docx",
"size": 4320133.12,
"mimetype": "application/vnd.openxmlformats-officedocument.wordprocessingml.document"
}
]
}
Request
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}--
Responce
HTTP/1.1 200 OK
Content-Type: application/zip
{Binary data of ZIP file}
Request
POST /api/mail/file HTTP/1.1
Content-Type: multipart/form-data; boundary=-{some-random-boundary}
Authorization: Basic xxxxxxxxxxx(64encoding)
-{some-random-boundary}
Content-Disposition: form-data; name="file"; filename="document.docx"
Content-Type: application/vnd.openxmlformats-officedocument.wordprocessingml.document
{Binary data of file}
-{some-random-boundary}
Content-Disposition: form-data; name="emails"
[email protected],[email protected],[email protected]
-{some-random-boundary}--
Responce
HTTP/1.1 200 OK
Request
GET /api/admin/log HTTP/1.1
Content-Type: multipart/form-data
Authorization: Basic xxxxxxxxxxx(64encoding)
Responce
HTTP/1.1 200 OK
Content-Type: text/plain
{Binary data of app.log file}
🚀 Deployment
⛏️ Built Using
✍️ Authors
🎉 Acknowledgements
- doodocs
- Alem school