Wenyan-lang HTTP API.
中文文档: README_zh-hans.md
Go to the repo: Wenyan-lang 文言文編程语言
git clone https://github.com/Vincent-the-gamer/wenyan-api.git
pnpm install
pnpm dev
Server will run at http://localhost:8080
by default.
You can change your host and port in server.ts
const host = "0.0.0.0"
const port = 8080
- URL:
http://localhost:8080
- Method:
post
- Request Body:
{ "code": "吾有一數。曰三。名之曰「甲」。為是「甲」遍。吾有一言。曰「「問天地好在。」」。書之。云云。" }
Then you will get your response:
{
"code": 200,
"data": "問天地好在。\n問天地好在。\n問天地好在。\n"
}
Example using axios to call API:
axios.post("http://localhost:8080",{
code: "吾有一數。曰三。名之曰「甲」。為是「甲」遍。吾有一言。曰「「問天地好在。」」。書之。云云。"
}).then(
res => {
console.log(res.data.data)
}
)
Write your Wenyan code in src/main.wy
吾有一數。曰三。名之曰「甲」。
為是「甲」遍。
吾有一言。曰「「問天地好在。」」。書之。
云云。
then
pnpm wyg run ./src/main.wy
Now you can use wyg packages
in your code.
Example:
- Install
# install package ziyue(子曰)
pnpm wyg i ziyue
# or
pnpm wyg i 子曰
- Usage
吾嘗觀「「子曰」」之書。方悟「子曰」之義。
子曰「「学而时习之,不亦说乎?」」。
Result:
__._
/ ___)_
(_/Y ===\ __
|||.==. =). |
|((| o |p| | 学而时习之,不亦说乎?
_./| \( /=\ ) |__
/ |@\ ||||||||.
/ \@\ ||||||||\
/ \ \@\ ||||||//\
( Y \@\|||| // _\
| -\ \@\ \\// \
| -\__.-./ //\.---.^__
| \ / |@|__/\_|@| | |
\__\ |@||| |||@| |
<@@@| |@||| |||@| /
/ ---| /@||| |||@| /
| /| /@/ || |||@| /|
| //| /@/ ||_|||@| / |
| // \ ||@| /|=|||@| | |
\ // \||@| / |/|||@| \ |
|// ||@| / ,/|||@| |
// ||@|/ /|/||/@/ |
//| , ||// /\|/\/@/ / /
//\ / \|/ /H\|/H\/ /_/
// |\_/ |__/|H\|/H|\_/
|/ |\ / |H===H| |
||\ /| |H|||H| |
||______/ | |H|||H| |
\_/ _/ _/ |L|||J| \_
_/ ___/ ___\__/___ '-._
/__________/===\__/===\---'
More about wyg:https://github.com/wenyan-lang/wyg