/go-fs-crud

Create, Read, Update and Delete on File System with Go.

Primary LanguageGo

F.S. C.R.U.D. A.P.I.

An Application Programming Interface to Create, Read, Update and Delete on a File System.

Documentation

To serve on localhost, run the main file of this repo.

go run main.go

Options

go run main.go -port=:1234 -store=./store

-port

Port to serve the API on. (Default: :1234)

-store

Path to the file storage directory. (Default: ./store)

Endpoints

Run in Postman

Create

curl --request POST 'localhost:1234/test.txt' --data-raw 'Booyaka'

Read

curl --request GET 'localhost:1234/test.txt'

Update

curl --request PUT 'localhost:1234/test.txt' --data-raw 'Boomshakalakasha'

Delete

curl --request DELETE 'localhost:1234/test.txt'

Tests

To run the unit tests.

go test -cover -v