- if you use packer
use({
"nxtcoder17/http-cli",
run = "pnpm i", -- npm i, as per your choice
config = function()
require("http-cli").setup()
end,
})
- default config
local defaultConfig = {
command = "Gql",
envFile = function()
return string.format("%s/%s", vim.env.PWD, "gqlenv.yml")
end,
}
- You should create a gqlenv.yml file in your project root directory, something like this
mode: dev
map:
dev:
url: <endpoint>
headers:
k1: v1
k2: v2
- then, create a file
$filename.yml
file
# filename: auth-graphql.yml
---
global:
email: "[email protected]"
---
query: |
mutation Login($email: String!, $password: String!) {
auth {
login(email: $email, password: $password) {
id
userId
userEmail
}
}
}
variables:
email: "{{email}}" # this is variable parsing, from either 'gqlenv.json' or from 'global' doc at the top
password: "hello"
- now, execute it
go run ./main.go -- $filename $envFileName $lineNumber
- you need to have a variable
url
either in one of the mode vars or global vars
.http file based REST Client in Neovim/vim and Intellij
- Neovim plugin that could just setup the previous step for you
- i don't know yet 😂