So I'm thinking something like this:
-----
// Create a webapp
forumApp myforum;
http_server.add_webapp("forum",myforum); // add the forumApp to the "/forum/"-path
-----
// Looking at the forumApp-class, it inherits the webapp_controller
class forumApp : public webapp_controller{
// Set up the "sub" controllers in a static method
static void add_controllers(dispatcher::ptr dispatcher){
// Add the controller "forumAdministration" to the subpath "/forum/admin/"
dispatcher->add_controller<forumAdministration>("admin");
// Add the controller "forumThread" to the subpath "/forum/thread/"
dispatcher->add_controller<forumThread>("thread");
// Also add actions related to this controller
dispatcher->add_action(&forumApp::about,"about");
}
void about(connection &con){
con.send_response("this is the best forumapp ever");
}
}-------
So, this is just initial thoughts. Writing about this helps me figure out how code would look like, and who knows, maybe I can catch someones attention.
Next up is how views should work and what type if template-system to use or not to use.
0 comments:
Post a Comment