MaCH repo
This commit is contained in:
25
02_hello_world_html/main.c
Normal file
25
02_hello_world_html/main.c
Normal file
@@ -0,0 +1,25 @@
|
||||
#include <mach.h>
|
||||
|
||||
config mach(){
|
||||
return (config) {
|
||||
.resources = {
|
||||
{"home", "/",
|
||||
.get = {
|
||||
validate({"name",
|
||||
.validation = "^\\S{1,16}$",
|
||||
.fallback = "world",
|
||||
.message = "must be 1-16 characters, no spaces"
|
||||
}),
|
||||
render(.template =
|
||||
"<html>"
|
||||
"<head></head>"
|
||||
"<body>"
|
||||
"<p>Hello {{name}}</p>"
|
||||
"</body>"
|
||||
"</html>"
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user