http
fastn
variable with content of JSON
fetched from HTTP.fastn
in
static site mode, then how the page looked when fastn build
was
called will be shown to everyone. But if you are using dynamic
mode then this page would be regenerated on every page load.-- record repo:
string full_name:
string description:
string html_url:
integer stargazers_count:
integer watchers_count:
-- record result:
integer total_count: 0
repo list items:
We have two records: repo
, and result
. We also have a variable of type result
.
-- import: fastn/processors as pr
-- result r:
$processor$: pr.http
url: https://api.github.com/search/repositories
sort: stars
order: desc
q: language:rust
url: string
method: optional string
get
as
default value. Currently only two methods are supported: get
and post
get
. Otherwise, the pair is passed as the request body.-- string amit-bio:
I am Amit.
-- person amit:
$processor$: pr.http
method: post
name: "Amit"
age: 33
bio: $amit-bio
post
method, the above code would convert into the following request body:{
"name": "Amit",
"age": 33,
"bio": "I am Amit."
}
Currently, there is no way to specify the type of the body parameters, so you
need to use "
to pass the value as a string type, or you can define any
variable and pass it as a reference since the type of the variable is known.
r
of type record result
defined above.