mirror of
https://github.com/sigmasternchen/Serwer
synced 2025-03-15 23:28:54 +00:00
rename main.c to exmaple.c
This commit is contained in:
parent
3b6a9ba3bb
commit
a62ed13e16
3 changed files with 8 additions and 8 deletions
6
Makefile
6
Makefile
|
@ -17,14 +17,14 @@ all: test
|
||||||
%.o: %.c
|
%.o: %.c
|
||||||
$(CC) $(CFLAGS) -c -o $@ $<
|
$(CC) $(CFLAGS) -c -o $@ $<
|
||||||
|
|
||||||
test: main.o webserver.o help.o
|
exmaple: exmaple.o webserver.o help.o
|
||||||
$(CC) $(LDFLAGS) -o $@ $^
|
$(CC) $(LDFLAGS) -o $@ $^
|
||||||
|
|
||||||
main.o: main.c webserver.h
|
exmaple.o: exmaple.c webserver.h
|
||||||
|
|
||||||
help.o: help.c help.h
|
help.o: help.c help.h
|
||||||
|
|
||||||
webserver.o: webserver.c webserver.h help.h
|
webserver.o: webserver.c webserver.h help.h
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
rm -f *.o test
|
rm -f *.o example
|
||||||
|
|
|
@ -12,7 +12,7 @@ Because W for web... Get it? ... Well next time I'll ask you for a catchy name,
|
||||||
|
|
||||||
### Is this ... thing ... even finished?
|
### Is this ... thing ... even finished?
|
||||||
No. There are many functions missing and the code needs some revision (and comments I suppose).
|
No. There are many functions missing and the code needs some revision (and comments I suppose).
|
||||||
There is a working mode though (see [the main file](main.c) for an example).
|
There is a working mode though (see [example.c](example.c) for an example).
|
||||||
|
|
||||||
If you want to help me with this project, feel free to fork and submit-pull requests.
|
If you want to help me with this project, feel free to fork and submit-pull requests.
|
||||||
I also appreciate opinions, suggestions and complaints.
|
I also appreciate opinions, suggestions and complaints.
|
||||||
|
@ -22,7 +22,7 @@ Both, I guess. Although as I'm thinking about it, it might actually be more of a
|
||||||
|
|
||||||
### Okay...? So, how can I use this thing?
|
### Okay...? So, how can I use this thing?
|
||||||
|
|
||||||
See [the main file](main.c).
|
See [exmaple.c](example.c).
|
||||||
|
|
||||||
Basically you need at least one handler.
|
Basically you need at least one handler.
|
||||||
```c
|
```c
|
||||||
|
|
|
@ -29,12 +29,12 @@ int main(int argc, char** argv) {
|
||||||
help_init(NULL, "test");
|
help_init(NULL, "test");
|
||||||
|
|
||||||
handle_t hello_handle = {
|
handle_t hello_handle = {
|
||||||
.host = NULL,
|
.host = ANY,
|
||||||
.path = "/world",
|
.path = "/world",
|
||||||
.handler = &hello_world
|
.handler = &hello_world
|
||||||
};
|
};
|
||||||
handle_t test_handle = {
|
handle_t test_handle = {
|
||||||
.host = NULL,
|
.host = ANY,
|
||||||
.path = "/test",
|
.path = "/test",
|
||||||
.handler = &test
|
.handler = &test
|
||||||
};
|
};
|
||||||
|
@ -45,7 +45,7 @@ int main(int argc, char** argv) {
|
||||||
.loglevel = LOG_DEBUG
|
.loglevel = LOG_DEBUG
|
||||||
};
|
};
|
||||||
|
|
||||||
webserver_t server = ws_create("test_server", NULL, "8080", stderr, options);
|
webserver_t server = ws_create("test_server", NULL , "8080", stderr, options);
|
||||||
|
|
||||||
ws_handle_add(&server, hello_handle);
|
ws_handle_add(&server, hello_handle);
|
||||||
ws_handle_add(&server, test_handle);
|
ws_handle_add(&server, test_handle);
|
Loading…
Reference in a new issue