在Lapis上用moonscript渲染和接收json

编辑整理:糖果

lapis = require "lapis"                                                                                                                                                   
import json_params from require "lapis.application"                                                                                                                       
                                                                                                                                                                          
class App extends lapis.Application                                                                                                                                       
  "/": =>                                                                                                                                                                 
    {                                                                                                                                                                     
      json: {                                                                                                                                                             
        success: true                                                                                                                                                     
        message: "hello world"                                                                                                                                            
      }                                                                                                                                                                   
    }                                                                                                                                                                     
  "/json": json_params =>                                                                                                                                                 
    @params.value    

用curl进行测试:

curl -H "Content-type: application/json"  -d '{"value": "hello"}'  0.0.0.0:8080/json

糖果

糖果
LUA从入门到放弃

服务器大负载情况下客户端出现Connection reset by peer

服务器大负载情况下客户端出现Connection reset by peer Continue reading

Nginx+Lua中文WIKI

Published on March 14, 2019

F5收购Nginx

Published on March 12, 2019