Skip to content

mateuspmello/storage

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

API Upload file

API Upload file is a service that provide you upload files and download thoses files

What does API Upload Files

API Upload Files is the most easy way to upload file to a server.

Prerequisites

You will need the following tools properly installed on your computer.

Test

Storage test

go test storagedata/storagedata_test.go

API test

go test storagedata/storagedata_test.go

Starting the service

go run cmd/apiamericanas/main.go

End Points

Send file

POST /sendfile

Curl example:

curl \
 -v -F path="ht/monthly" \
 -F file=@"/home/mateus-mello/go/src/americanas/test_files/mars.png" \
 http://localhost:8081/sendfile 

All files

GET /allfiles

Curl example:

curl -X GET 'http://localhost:8081/allfiles'

Delete file

POST /delete?data=FileID

Curl example:

curl -X POST 'http://localhost:8081/delete?data=fa0ecd5f42635c34e2f879a24039988e'

Get file by id

GET /byid?data=FileID

Curl example:

curl -X GET 'http://localhost:8081/byid?data=0cb90ac871279cc942de976882b71a00'

Move file to another dir

POST /movefile?data=FileID

Curl example:

curl -X POST 'http://localhost:8081/movefile?data=0cb90ac871279cc942de976882b71a00' \
-d '{"directory": "solarsystem/planets"}'

Overwrite file

POST /overwrite?data=FileID

Curl example:

curl \
 -F file=@"/home/mateus-mello/go/src/americanas/test_files/perseverance.png" \
 http://localhost:8081/overwrite?data=0cb90ac871279cc942de976882b71a00

Download file

GET /storagedata/dirOfFile

Curl example:

curl -X GET 'http://localhost:8081/storagedata/solarsystem/planets/perseverance.png'

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages