Skip to content

Wenyan-lang HTTP API. 文言文编程语言HTTP API。

Notifications You must be signed in to change notification settings

Vincent-the-gamer/wenyan-api

Repository files navigation

Wenyan API

Wenyan-lang HTTP API.

中文文档: README_zh-hans.md

What is Wenyan-lang?

Go to the repo: Wenyan-lang 文言文編程语言

Usage

Clone This Repository

git clone https://github.com/Vincent-the-gamer/wenyan-api.git

Install Dependency

pnpm install

Run Server

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

Call API

  • 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)
    }
)

Run code in shell(Use CLI)

Write your Wenyan code in src/main.wy

吾有一數。曰三。名之曰「甲」。
為是「甲」遍。
    吾有一言。曰「「問天地好在。」」。書之。
云云。

then

pnpm wyg run ./src/main.wy

Package Manager: Wyg(文渊阁, 文淵閣, Wenyan-get)

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

About

Wenyan-lang HTTP API. 文言文编程语言HTTP API。

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published