知识卡片
启动或批量运行超媒体脚本
HyperCLI是一个面向HTTP与超媒体表示的REPL。书中安装命令为npm install -g @mamund/hyper,以hyper进入交互,再执行GOTO <url>。已写好的HyperLANG文件可用hyper <脚本文件输入,适合复用一串交互。示例Heroku地址属于2022年环境,本卡未安装或访问该服务,也不保证现在仍在线。
这张卡片看不懂?
这张卡片的反馈已满 10 条,暂时无法继续提交。
已有反馈 · 0 / 10 条
还没有人提交反馈。
在整书笔记中的位置
原书出处 · 1 处
- 附录D:HyperCLI操作参考 · 查看原书依据
Here’s a super simple HyperLANG script: GOTO https://company-atk.herokuapp.com And here’s how you do it: Make sure you have installed the latest update of the HyperCLI: $> npm install -g @mamund/hyper Launch the HyperCLI REPL: $> hyper Type the following command and press Enter: > GOTO https://company-atk.herokuapp.com It may take a few seconds for the sample service to fire up, but eventually you should see the following response: STATUS 200 https://company-atk.herokuapp.com application/forms+json; charset=utf-8 You can also view the request/response details with these commands: SHOW REQUEST SHOW RESPONSE SHOW METADATA SHOW ALL SHOW URL SHOW STATUS SHOW CONTENT-TYPE SHOW HEADERS Finally, you can place all the HyperLANG commands in a text file and then pipe that file into the HyperCLI, like this: $> hyper <hello-hyper.script Congratulations! You’ve just created your first HyperLANG program.