Simple embedded HTTP server library
Posted: Mon Feb 22, 2016 1:15 pm
Hello,
I have written simple embedded http library for Windows IoT.
Currently it includes GET requests, subset of POST requests, cookies, sessions,
timers, very basic (but extendable) template and json support and support for reading embedded resources.
It allso supports basic user authentication.
User code is called from listeners, that are provided request and response classes.
Timer events are not provided any parameters as they are not associated to HTTP requests.
Sessions can be automatically generated and set to expire after 2 hours of inactivity, but that can be configured.
Allso provided is (at the moment) very small parts library.
Usage is very simple, to crate basic server that responds to http conenctions, you have to write:
That will start the server on port 8000 and display simple hello world stye page.
To do anything more, you just add listeners, timers, ...
For example:
Now your DemoListener will get called whenever user requests yourserver:8000/demo.html page.
you can find code on github page: https://github.com/strehar/HttpServer
I hope someone finds this usefull. Let me know how it goes.
Dest regards.
---------
Miha
I have written simple embedded http library for Windows IoT.
Currently it includes GET requests, subset of POST requests, cookies, sessions,
timers, very basic (but extendable) template and json support and support for reading embedded resources.
It allso supports basic user authentication.
User code is called from listeners, that are provided request and response classes.
Timer events are not provided any parameters as they are not associated to HTTP requests.
Sessions can be automatically generated and set to expire after 2 hours of inactivity, but that can be configured.
Allso provided is (at the moment) very small parts library.
Usage is very simple, to crate basic server that responds to http conenctions, you have to write:
Code: Select all
HttpServer server = new HttpServer();
server.start();
To do anything more, you just add listeners, timers, ...
For example:
Code: Select all
HttpServer server = new HttpServer();
server.AddPath("/demo.html", DemoListener);
server.start();
you can find code on github page: https://github.com/strehar/HttpServer
I hope someone finds this usefull. Let me know how it goes.
Dest regards.
---------
Miha
