这是webcppd升级为httpevent后的第二个更新。 主要更新:
httpevent 是webcppd的继承者,在多个方面增强了后者,并且融入了lua开发要素,可同时支持使用c++和lua进行web开放。 C++ HELLOWORLD: #include <httpevent.hpp>
namespace httpevent {
class hello : public view {
void handler(const request& req, response& res) {
res.send_head("Content-Type", "text/plain;charset=UTF-8")
.send_body("hello,world");
}
};
} lua HELLOWORLD: local hello={}
function hello.main()
httpevent.response:send_head("Content-Type", "text/plain;charset=UTF-8")
:send_body('hello,world')
end
return hello 依赖:
开发例子请参考:https://github.com/webcpp/httpevent/tree/master/plugin |