1a06c2b0c7
* adds proto files for netstate crud * moves netstate grpc client lib into pkg/netstate where grpc netstate service is defined * starts adding grpc client and server tests * moves creation of grpc server into cmd/netstate/main.go, removes pkg/netstate/service.go, adds more client testing * changed all 'Path' and 'Value' fields from strings to bytes, updated tests * changes Get and Delete in proto file to receive 'requests' instead of 'file paths', adds tests for Get, List, and Delete * changes netstate-routes to get 'fileValue' bytes not 'fileInfo' * adds example rpc client in 'examples' and adds more specific debug logs * adds readmes for netstate rpc services and updates netstate-routes
21 lines
884 B
Markdown
21 lines
884 B
Markdown
# HTTP + BoltDB Crud Interface
|
|
|
|
This is an http server that provides a CRUD (create, read, update, delete) interface for storing file paths and small values with BoltDB.
|
|
For example, you can store a value (i.e. "hello world") at `/my/test/file` and interact with `/my/test/file` through an API, backed by BoltDB.
|
|
|
|
To run:
|
|
```
|
|
go run cmd/netstate-http/main.go
|
|
```
|
|
You can also run using these flags: `-port=<port-number> -prod=<bool> -db=<db-name>`
|
|
|
|
Then you can use http methods (Put, Get, List, and Delete) to interact with small values stored on BoltDB.
|
|
To store a value, put it into the PUT request body using this format:
|
|
```
|
|
{
|
|
"value": "here's my value"
|
|
}
|
|
```
|
|
If you're using Postman, select the `raw` request setting to do this.
|
|
|
|
Afterward, you can also use [Bolter](https://github.com/hasit/bolter) or a similar BoltDB viewer to make sure your files were changed as expected. |