Skip to content

Commit

Permalink
Merge pull request #119 from joernio/michael/joern-server
Browse files Browse the repository at this point in the history
document how to run queries against joern server
  • Loading branch information
itsacoderepo authored Dec 4, 2024
2 parents 26ca3cd + 88b2e34 commit ba296e8
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions docs.joern.io/content/server.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,24 @@ The hostname and port can also be specified:
joern --server --server-host localhost --server-port 8081
```

Run queries on the remote joern instance using `curl` and `jq`:
```shell
function joern-remote() {
QUERY="{\"query\": \"$@\"}"
curl --silent http://localhost:8080/query-sync -X POST -d $QUERY | jq --raw-output .stdout
}

$ joern-remote 'val foo = 42'
> val foo: Int = 42

$ joern-remote 'println(\"remote execution vector - this prints on the server\")'
>

$ joern-remote 'importCode(\"/path/on/server\")'
val res1: io.shiftleft.codepropertygraph.generated.Cpg = Cpg[Graph[45 nodes]]
```
A sample client is available for Python at:
https://github.com/joernio/cpgqls-client-python#example-usage
Expand Down

0 comments on commit ba296e8

Please sign in to comment.