http::controller mypage
{
//Browsing to http://server/mypage/test?some_str=blah¶m=5 calls this
http::response test( const std::string& some_str, const unsigned param )
{
return web::response{ 200, "You did awesome stuff" };
}
//This method can only be called with HTTP POST
[[POST]] http::response save_some_data( const std::string& blah )
{
return 200;
}
};
int main()
{
http::server server( "localhost", 80 );
server.add_route( "mypage", std::make_unique< mypage >() );
server.run();
}
It's all the magic of a modern web framework but in a fast language.Due to web assembly you can easily have your server and client side scripting be done in the same language, with the same libraries which is also huge bonus.
I honestly can't think of a better stack.