mirror of
https://github.com/sigmasternchen/CShore
synced 2025-03-15 08:08:56 +00:00
added demo for template response
This commit is contained in:
parent
8889fd64ec
commit
602b017745
2 changed files with 17 additions and 0 deletions
|
@ -26,3 +26,8 @@ response_t user(ctx_t ctx) {
|
|||
|
||||
return jsonResponse(200, user_t, &user);
|
||||
}
|
||||
|
||||
GET("/template", template);
|
||||
response_t template(ctx_t ctx) {
|
||||
return templateResponse(200, "demo.templ", "Page Title", "Overflow");
|
||||
}
|
||||
|
|
12
demo/demo.templ
Normal file
12
demo/demo.templ
Normal file
|
@ -0,0 +1,12 @@
|
|||
{$ char* title, char* name $}
|
||||
%%
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>{{ "%s", title }}</title>
|
||||
</head>
|
||||
<body>
|
||||
<h1>Hello {{ "%s", name }}!</h1>
|
||||
</body>
|
||||
</html>
|
||||
|
Loading…
Reference in a new issue