1.0.3 • Published 5 years ago
joj v1.0.3
Lightweight CLI http client.
joj lets you manage request collections with plain javascript files.
Usage
npm install -g jojCreate a request file:
#!/usr/bin/env joj
url('https://jsonplaceholder.typicode.com/todos/3')
method('get')
header('accepts', 'application/json')Give it execution permissions:
chmod +x my_request_file.jsAnd execute it:
./my_request_file.jsjoj outputs the status code, headers, and body of the response as json. This is useful for piping the output to tools like jq.
Using environment variables
Define a file called blue.env.json in the same folder as your request files:
{
"MY_API": "https://example.com"
}Then, in your request files:
env('blue')
url(useenv('{{MY_API}}/veryimportant/todos'))By default, joj tries to load a file called default.env.json.