main.C 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. /*
  2. * Copyright (C) 2009 Emweb bvba, Kessel-Lo, Belgium.
  3. *
  4. * See the LICENSE file for terms of use.
  5. */
  6. #include <Wt/WServer>
  7. #include <Wt/Dbo/SqlConnectionPool>
  8. #include "BlogRSSFeed.h"
  9. #include "model/BlogSession.h"
  10. #include "model/Token.h"
  11. #include "model/User.h"
  12. #include "WtHome.h"
  13. #include "JWtHome.h"
  14. int main(int argc, char **argv)
  15. {
  16. try {
  17. WServer server(argc, argv, WTHTTP_CONFIGURATION);
  18. BlogSession::configureAuth();
  19. Wt::Dbo::SqlConnectionPool *blogDb
  20. = BlogSession::createConnectionPool(server.appRoot() + "blog.db");
  21. BlogRSSFeed rssFeed(*blogDb, "Wt and JWt blog",
  22. "http://www.webtoolkit.eu/wt/blog",
  23. "We care about our webtoolkits.");
  24. server.addResource(&rssFeed, "/wt/blog/feed/");
  25. server.addEntryPoint(Application,
  26. boost::bind(&createJWtHomeApplication, _1, blogDb),
  27. "/jwt", "/css/jwt/favicon.ico");
  28. server.addEntryPoint(Application,
  29. boost::bind(&createWtHomeApplication, _1, blogDb),
  30. "", "/css/wt/favicon.ico");
  31. server.run();
  32. delete blogDb;
  33. } catch (Wt::WServer::Exception& e) {
  34. std::cerr << e.what() << std::endl;
  35. } catch (std::exception &e) {
  36. std::cerr << "exception: " << e.what() << std::endl;
  37. }
  38. }