Skip to content

Commit

Permalink
Add instructions for testing requsts and doing uploads.
Browse files Browse the repository at this point in the history
  • Loading branch information
emmiegit committed Sep 30, 2024
1 parent ba8d487 commit 88d16a0
Showing 1 changed file with 30 additions and 0 deletions.
30 changes: 30 additions & 0 deletions deepwell/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,36 @@ $ cargo fmt # Ensure code is formatted
$ cargo clippy # Check code for lints
```

### Running requests

When you have a local instance of DEEPWELL running, probably in the developement `docker-compose` instance, you may want to run requests against it. You can easily accomplish this with a tool like `curl`. The basic format is:

```sh
$ curl -X POST --json '{"jsonrpc":"2.0","method":"<method here>","params":<json data of request>,"id":<request id>}' http://localhost:2747/jsonrpc
```

Where you pass in the JSONRPC method name and corresponding JSON data. The ID value distinguishes between notices and requests, see the JSONRPC specification for information.

For instance:

```sh
$ curl -X POST --json '{"jsonrpc":"2.0","method":"echo","params":{"my":["json","data"]},"id":0}' http://localhost:2747/jsonrpc

{"jsonrpc":"2.0","id":0,"result":{"my":["json","data"]}}

$ curl -X POST --json '{"jsonrpc":"2.0","method":"ping","id":0}' http://localhost:2747/jsonrpc

{"jsonrpc":"2.0","id":0,"result":"Pong!"}
```

If you are unfamiliar with JSONRPC, you can read about it [on its website](https://www.jsonrpc.org/specification). For instance, one quirk is that for methods which take a non-list or object argument, you specify it as a list of one element.

**NOTE:** When you are uploading files to local minio as part of testing file upload flows, **you must leave the URL unmodified**. The host `files` is used as the S3 provider, which is a problem since this is not a valid host on your development machine, which necessitates use of `--connect-to` to tell `curl` to connect to the appropriate location instead:

```sh
$ curl --connect-to files:9000:localhost:9000 --upload-file <path-to-file> <s3-presign-url>
```

### Database

There are two important directories related to the management of the database (which DEEPWELL can be said to "own"). They are both fairly self-explanatory:
Expand Down

0 comments on commit 88d16a0

Please sign in to comment.