From 817c7955e7a31969c9d9c0efe64f82f451ce1a09 Mon Sep 17 00:00:00 2001 From: albaropereyra22 <141711575+albaropereyra22@users.noreply.github.com> Date: Sun, 13 Aug 2023 22:02:28 -0700 Subject: [PATCH] Update IndexPage.csp Fixed indentation and remove excessive lines. Fixed indentation and remove excessive lines. --- backend/templates/IndexPage.csp | 35 ++++++++++++++++----------------- 1 file changed, 17 insertions(+), 18 deletions(-) diff --git a/backend/templates/IndexPage.csp b/backend/templates/IndexPage.csp index d3604fe..eb58df3 100644 --- a/backend/templates/IndexPage.csp +++ b/backend/templates/IndexPage.csp @@ -30,7 +30,7 @@

Run your application anywhere, knowing it is as fast as it could be.

- +

View releases On GitHub @@ -38,7 +38,7 @@ - +

@@ -97,48 +97,48 @@
- +

Code snippets

Hello World

using Callback = std::function<void (const HttpResponsePtr &)> ;
-
-app().registerHandler("/", [](const HttpRequestPtr& req, Callback &&callback)
-{
+	
+	app().registerHandler("/", [](const HttpRequestPtr& req, Callback &&callback)
+	{
 	auto resp = HttpResponse::newHttpResponse();
 	resp->setBody("Hello World");
 	callback(resp);
-});
+ });

File upload

app().registerHandler("/upload", [](const HttpRequestPtr& req, Callback &&callback))
-{
+	{
 	MultiPartParser fileUpload;
 	if (fileUpload.parse(req) != 0 || fileUpload.getFiles().size() == 0) {
 		// The framework handles an exception by logging it, and
 		// by responding to the client with an HTTP 500 status code.
 		throw std::runtime_error("Something went wrong");
 	}
-
+	
 	auto &file = fileUpload.getFiles()[0];
 	file.save();
 	callback(HttpResponse::newHttpResponse());
-});
+ });

DB with coroutines

app().registerHandler("/get_num_users", [](HttpRequestPtr req) -> Task<HttpResponsePtr>
-{
+	{
 	auto client = app().getDbClient();
 	auto result = co_await client->execSqlCoro("SELECT COUNT(*) FROM users;");
-
+	
 	auto resp = HttpResponse::newHttpResponse();
 	resp->setBody(std::to_string(result[0][0].as<size_t>()));
 	co_return resp;
-});
+ });
- +

Join Us

@@ -164,12 +164,12 @@ app().registerHandler("/", [](const HttpRequestPtr& req, Callback &&callback)
- +

We also want to thank everyone whom contributed to the project:

- +