You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
30 lines
647 B
C
30 lines
647 B
C
![]()
7 years ago
|
#ifndef WEBCC_REST_SERVICE_H_
|
||
|
#define WEBCC_REST_SERVICE_H_
|
||
![]()
7 years ago
|
|
||
|
#include <string>
|
||
|
#include <memory>
|
||
|
|
||
![]()
7 years ago
|
#include "webcc/common.h"
|
||
![]()
7 years ago
|
|
||
![]()
7 years ago
|
namespace webcc {
|
||
![]()
7 years ago
|
|
||
|
// Base class for your REST service.
|
||
|
class RestService {
|
||
|
public:
|
||
|
virtual ~RestService() {
|
||
|
}
|
||
|
|
||
|
// Handle REST request, output the response.
|
||
|
// Both the request and response parameters should be JSON.
|
||
|
// TODO: Query parameters.
|
||
|
virtual bool Handle(const std::string& http_method,
|
||
|
const std::string& request,
|
||
|
std::string* response) = 0;
|
||
|
};
|
||
|
|
||
|
typedef std::shared_ptr<RestService> RestServicePtr;
|
||
|
|
||
![]()
7 years ago
|
} // namespace webcc
|
||
![]()
7 years ago
|
|
||
![]()
7 years ago
|
#endif // WEBCC_REST_SERVICE_H_
|