Go to file
Schneider Roland bc8e58e472 add auth
2025-02-21 23:37:46 +01:00
.gitignore add auth 2025-02-21 23:37:46 +01:00
Dockerfile inital commit 2025-02-21 17:14:55 +01:00
index.js add auth 2025-02-21 23:37:46 +01:00
package-lock.json inital commit 2025-02-21 17:14:55 +01:00
package.json inital commit 2025-02-21 17:14:55 +01:00
README.md add auth 2025-02-21 23:37:46 +01:00
test-1.txt add auth 2025-02-21 23:37:46 +01:00

simple http file api

Create Docker image

npm i

docker build -t simple-http-upload:0.1.0 .

docker build -t 172.22.102.100:40016/team-mmkb/simple-http-upload:0.1.0 .

sudo vim /etc/docker/daemon.json

{
    "insecure-registries" : [ "172.22.102.100:40016" ]
}

docker login 172.22.102.100:40016/team-mmkb/simple-http-upload:0.1.0 docker push 172.22.102.100:40016/team-mmkb/simple-http-upload:0.1.0

Run

docker run --rm -p 3000:3000 -v ./data:/data simple-http-upload:0.1.0

docker run --rm -p 3000:3000 -v ./data:/data 172.22.102.100:40016/team-mmkb/simple-http-upload:0.1.0

docker run --rm -p 3000:3000 -v ./data:/data -e API_KEY=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiJtbWtiIiwibmFtZSI6Im1ta2IiLCJpYXQiOjE1MTYyMzkwMjJ9.vBHcF6SFhImcGC4xDxKdPyq3shjNTPkVxkvdDyfx7Ss simple-http-upload:0.1.0

Test

curl -XPOST -F 'data=@test-5.txt' localhost:3000/ 

curl -XPOST -F 'data=@test-1.txt' --header "Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiJtbWtiIiwibmFtZSI6Im1ta2IiLCJpYXQiOjE1MTYyMzkwMjJ9.vBHcF6SFhImcGC4xDxKdPyq3shjNTPkVxkvdDyfx7Ss" localhost:3000/