Added dynamic pages with dynamic linking during runtime
This commit is contained in:
14
example/library.c
Normal file
14
example/library.c
Normal file
@@ -0,0 +1,14 @@
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include <swebs/swebs.h>
|
||||
|
||||
int getResponse(Request *request, Response *response) {
|
||||
char *str = "<h1>Hello world!</h1>";
|
||||
response->type = BUFFER;
|
||||
response->response.buffer.data = malloc(30);
|
||||
strcpy(response->response.buffer.data, str);
|
||||
response->response.buffer.len = strlen(str);
|
||||
return 200;
|
||||
}
|
||||
Reference in New Issue
Block a user