Wt examples
4.11.3
wt-homepage
main.C
Go to the documentation of this file.
1
/*
2
* Copyright (C) 2009 Emweb bv, Herent, Belgium.
3
*
4
* See the LICENSE file for terms of use.
5
*/
6
7
#include <Wt/WServer.h>
8
#include <Wt/Dbo/SqlConnectionPool.h>
9
10
#include "BlogRSSFeed.h"
11
#include "model/BlogSession.h"
12
#include "model/Token.h"
13
#include "model/User.h"
14
#include "
WtHome.h
"
15
#include "
JWtHome.h
"
16
17
using namespace
Wt
;
18
19
int
main
(
int
argc,
char
**argv)
20
{
21
try
{
22
WServer
server(argc, argv, WTHTTP_CONFIGURATION);
23
24
BlogSession::configureAuth();
25
26
std::unique_ptr<Dbo::SqlConnectionPool> blogDb
27
= BlogSession::createConnectionPool(server.
appRoot
() +
"blog.db"
);
28
29
auto
rssFeed = std::make_shared<BlogRSSFeed>(*blogDb,
30
"Wt and JWt blog"
,
31
"http://www.webtoolkit.eu/wt/blog"
,
32
"We care about our webtoolkits."
);
33
34
server.
addResource
(rssFeed,
"/wt/blog/feed/"
);
35
36
server.
addEntryPoint
(
EntryPointType::Application
,
37
std::bind(&
createJWtHomeApplication
, std::placeholders::_1, blogDb.get()),
38
"/jwt"
,
"/css/jwt/favicon.ico"
);
39
server.
addEntryPoint
(
EntryPointType::Application
,
40
std::bind(&
createWtHomeApplication
, std::placeholders::_1, blogDb.get()),
41
""
,
"/css/wt/favicon.ico"
);
42
43
server.
run
();
44
45
}
catch
(
Wt::WServer::Exception
& e) {
46
std::cerr << e.
what
() << std::endl;
47
}
catch
(std::exception &e) {
48
std::cerr <<
"exception: "
<< e.
what
() << std::endl;
49
}
50
}
createJWtHomeApplication
std::unique_ptr< WApplication > createJWtHomeApplication(const WEnvironment &env, Dbo::SqlConnectionPool *blogDb)
Definition:
JWtHome.C:157
JWtHome.h
createWtHomeApplication
std::unique_ptr< WApplication > createWtHomeApplication(const WEnvironment &env, Dbo::SqlConnectionPool *blogDb)
Definition:
WtHome.C:172
WtHome.h
Wt::WException::what
virtual const char * what() const override
Wt::WServer::Exception
Wt::WServer
Wt::WServer::appRoot
WT_API std::string appRoot() const
Wt::WServer::run
WTCONNECTOR_API void run()
Wt::WServer::addEntryPoint
WT_API void addEntryPoint(EntryPointType type, ApplicationCreator callback, const std::string &path=std::string(), const std::string &favicon=std::string())
Wt::WServer::addResource
WT_API void addResource(const std::shared_ptr< WResource > &resource, const std::string &path)
main
int main(int argc, char **argv)
Definition:
main.C:19
Wt
Wt::EntryPointType::Application
@ Application
Generated on Wed Feb 19 2025 for
the C++ Web Toolkit (Wt)
by
1.9.1