54 lines
1.1 KiB
C++
54 lines
1.1 KiB
C++
#ifndef __RESTFUL_H__
|
|
#define __RESTFUL_H__
|
|
|
|
#include <Wt/Dbo/Session.h>
|
|
#include <Wt/Dbo/Types.h>
|
|
#include <Wt/WResource.h>
|
|
#include <random>
|
|
|
|
class MyMessage {
|
|
public:
|
|
int status = 0;
|
|
std::string message;
|
|
std::string user;
|
|
|
|
template <class Action>
|
|
void persist(Action &a) {
|
|
Wt::Dbo::field(a, status, "status");
|
|
Wt::Dbo::field(a, message, "message");
|
|
Wt::Dbo::field(a, user, "user");
|
|
}
|
|
};
|
|
|
|
class World {
|
|
public:
|
|
int randomNumber;
|
|
|
|
template <class Action>
|
|
void persist(Action &a) {
|
|
Wt::Dbo::field(a, randomNumber, "randomnumber");
|
|
}
|
|
};
|
|
|
|
class Fortune {
|
|
public:
|
|
std::string message;
|
|
|
|
template <class Action>
|
|
void persist(Action &a) {
|
|
Wt::Dbo::field(a, message, "message");
|
|
}
|
|
};
|
|
|
|
class AuthenticationResource : public Wt::WResource {
|
|
public:
|
|
AuthenticationResource();
|
|
void handleRequest(const Wt::Http::Request &request, Wt::Http::Response &response) final;
|
|
};
|
|
|
|
class PlaintextResource : public Wt::WResource {
|
|
public:
|
|
void handleRequest(const Wt::Http::Request &request, Wt::Http::Response &response) final;
|
|
};
|
|
|
|
#endif // __RESTFUL_H__
|