Better front page example
This commit is contained in:
@@ -4,7 +4,7 @@
|
||||
<i>Simple, secure</i><sup><a href="https://github.com/uNetworking/uWebSockets/tree/master/fuzzing#fuzz-testing-of-various-parsers-and-mocked-examples">1</a></sup><i> & standards compliant</i><sup><a href="https://unetworking.github.io/uWebSockets.js/report.pdf">2</a></sup><i> web server for the most demanding</i><sup><a href="https://github.com/uNetworking/uWebSockets/tree/master/benchmarks#benchmark-driven-development">3</a></sup><i> of applications.</i> <a href="https://github.com/uNetworking/uWebSockets/blob/master/misc/READMORE.md">Read more...</a>
|
||||
<br><br>
|
||||
|
||||
<a href="https://github.com/uNetworking/uWebSockets/releases"><img src="https://img.shields.io/github/v/release/uNetworking/uWebSockets"></a> <a href="https://osv.dev/list?q=uwebsockets&affected_only=true&page=1&ecosystem=OSS-Fuzz"><img src="https://oss-fuzz-build-logs.storage.googleapis.com/badges/uwebsockets.svg" /></a> <img src="https://img.shields.io/badge/Est.-2016-green" />
|
||||
<a href="https://github.com/uNetworking/uWebSockets/releases"><img src="https://img.shields.io/github/v/release/uNetworking/uWebSockets"></a> <a href="https://osv.dev/list?q=uwebsockets&affected_only=true&page=1&ecosystem=OSS-Fuzz"><img src="https://oss-fuzz-build-logs.storage.googleapis.com/badges/uwebsockets.svg" /></a> <img src="https://img.shields.io/badge/est.-2016-green" />
|
||||
|
||||
</div>
|
||||
<br><br>
|
||||
@@ -29,16 +29,21 @@ Designed around a convenient URL router with wildcard & parameter support - pair
|
||||
Start building your Http & WebSocket apps in no time; <a href="https://github.com/uNetworking/uWebSockets/blob/master/misc/READMORE.md">read the user manual</a> and <a href="https://github.com/uNetworking/uWebSockets/tree/master/examples">see examples</a>. You can browse our <a href="https://unetworking.github.io/uWebSockets.js/generated/">TypeDoc</a> for a quick overview.
|
||||
|
||||
```c++
|
||||
/* One app per thread; spawn as many as you have CPU-cores and let uWS share the listening port */
|
||||
uWS::SSLApp({
|
||||
|
||||
/* These are the most common options, fullchain and key. See uSockets for more options. */
|
||||
.cert_file_name = "cert.pem",
|
||||
.key_file_name = "key.pem"
|
||||
|
||||
}).get("/hello", [](auto *res, auto *req) {
|
||||
}).get("/hello/:name", [](auto *res, auto *req) {
|
||||
|
||||
/* You can efficiently stream huge files too */
|
||||
res->writeHeader("Content-Type", "text/html; charset=utf-8")->end("Hello HTTP!");
|
||||
res->writeStatus("200 OK")
|
||||
->writeHeader("Content-Type", "text/html; charset=utf-8")
|
||||
->write("<h1>Hello ")
|
||||
->write(req->getParameter("name"))
|
||||
->end("!</h1>");
|
||||
|
||||
}).ws<UserData>("/*", {
|
||||
|
||||
|
||||
Reference in New Issue
Block a user