探索flutter框架开发的app在移动应用市场的潜力与挑战
808
2022-10-14
Valatra- Vala 的 Web 框架
Valatra 是一个 Vala 语言用来开发 Web 应用的框架,灵感来自于 Ruby 的Sinatra 框架。
示例代码:
var app = new Valatra.App();app.port = 3333;app.get('/', (req, res) => { /* 200 by default */ res.status = 200; /* sets content-type, 'text/html' by default */ res.type("text/plain"); /* set whatever HTTP header */ res.headers["MY_HEADER"] = "Hello!"; res.setBody("Hello World!");});// this would be called for a request to '/user/john', or '/user/123', etcapp.get("/user/:id", (req, res) => { var id = req.params["id"]; // do something with id...});app.post("/submit", (req, res) => { // if a POST was made to "/submit with a body of //"title=My+Awesome+Title", req.params["title"] // would return that req.params["title"];});app.start();
版权声明:本文内容由网络用户投稿,版权归原作者所有,本站不拥有其著作权,亦不承担相应法律责任。如果您发现本站中有涉嫌抄袭或描述失实的内容,请联系我们jiasou666@gmail.com 处理,核实后本网站将在24小时内删除侵权内容。
发表评论
暂时没有评论,来抢沙发吧~