Skip to content

Commit 7d497b3

Browse files
marc0derclaude
andcommitted
docs: add local setup and API usage examples to README
Co-Authored-By: Claude <[email protected]>
1 parent 5c05158 commit 7d497b3

File tree

1 file changed

+45
-1
lines changed

1 file changed

+45
-1
lines changed

README.md

Lines changed: 45 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,48 @@ The audience of this API is twofold:
88

99
* as a backend for the [native components](https://github.com/sdkman/sdkman-cli-native) written in Rust
1010
* as admin API of the datastore, used directly or by build system plugins and
11-
the [DISCO integration](https://github.com/sdkman/sdkman-disco-integration)
11+
the [DISCO integration](https://github.com/sdkman/sdkman-disco-integration)
12+
13+
## Running Locally
14+
15+
1. Start PostgreSQL database:
16+
```bash
17+
docker run --restart=always \
18+
--name postgres \
19+
-p 5432:5432 \
20+
-e POSTGRES_USER=postgres \
21+
-e POSTGRES_PASSWORD=postgres \
22+
-e POSTGRES_DB=sdkman \
23+
-d postgres
24+
```
25+
26+
2. Run the service:
27+
```bash
28+
./gradlew run
29+
```
30+
31+
The service will start on port 8080.
32+
33+
## Running Tests
34+
35+
```bash
36+
./gradlew test
37+
```
38+
39+
## API Usage Examples
40+
41+
### POST a new version (requires authentication):
42+
```bash
43+
http POST localhost:8080/versions \
44+
candidate=java \
45+
version=21.0.2 \
46+
platform=LINUX_X64 \
47+
url=https://download.oracle.com/java/21/archive/jdk-21.0.1_linux-x64_bin.tar.gz \
48+
visible:=true \
49+
--auth testuser:password123
50+
```
51+
52+
### GET versions for a candidate:
53+
```bash
54+
http GET localhost:8080/versions/java
55+
```

0 commit comments

Comments
 (0)