-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathservice.cpp
More file actions
38 lines (33 loc) · 736 Bytes
/
service.cpp
File metadata and controls
38 lines (33 loc) · 736 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
/*
${api.description}
*/
#include "cwapper.hpp"
#include "restful.hpp"
class service: public cwapper::restful {
public:
service(cppcms::service &srv): restful::restful(srv) {};
{% for r in api.routes %}\
{% for m in r.path.methods %}\
cwapper::data ${m.operationId}(${m.signature}) {
// Implementation goes here
{% choose %}\
{% when m.bodyparam %}\
return ${m.bodyparam.name};
{% end %}\
{% otherwise %}\
return cwapper::data();
{% end %}\
{% end %}\
}
{% end %}\
{% end %}\
};
int main(int argc,char ** argv) {
try {
cppcms::service srv(argc,argv);
srv.applications_pool().mount(cppcms::applications_factory<service>());
srv.run();
} catch(std::exception const &e) {
std::cerr << e.what() << std::endl;
}
}