فهرست منبع

Adding /devblog

Will just return a json array used in the frontend to display the development blog.
Ecconia 7 سال پیش
والد
کامیت
a4a078cabb
1فایلهای تغییر یافته به همراه69 افزوده شده و 0 حذف شده
  1. 69 0
      handler/MyHandler.php

+ 69 - 0
handler/MyHandler.php

@@ -32,10 +32,79 @@
 			throw new Error('Lol', 42);
 		}
 
+		public function devblog(ServerRequestInterface $request, ResponseInterface $response, \stdClass $args): ResponseInterface {
+
+			$blog = '
+				Ecconia\'s dusty server-machine
+				-	For this project the webserver owned by Ecconia has been started again and a fresh Ubuntu 18.04 has been installed.
+				-	Basic setup has been made, editing bash, setting up ssh and vim.
+
+				Sever software
+				-	Nginx shall be the server for this project, its easy to setup and all config files are at one place.
+
+				Security
+				-	All traffic will be routed over Cloudflare. The connections from and to Cloudflare are encrypted with SSL.
+				-	The connection is as secure as Cloudflare is (lets trust it...). Cloudflare mainly caches files and protects against DDOS.
+
+				Vue-Framework added to website
+				-	Vue is a framework which uses javascript to manipulate the HTML-DOM of the browser. This allows very easy web-developing.
+				-	Nice feature: Updating the website according to JS variables.
+				-	Downside: SEO may fail.
+
+				After reading millions of documentation
+				-	The first simple version of the website has been written, a single HTMl file contains the whole website.
+
+				Vue-Router
+				-	The website is using Vue-Router it allows natural page switching without actually doing so. The content will just be replaced by Vue.
+
+				The small steps
+				-	The start page as well as the application page shall function the same as on the current website. Additional this devblog has been added. An Impressum is a must have as soon as the server is located in germany.
+
+				Finally backend for frontend
+				-	Vue has \"components\" each mainpage is one, but later other parts of the website may be components (buttons, inputs, pager, posts etc....)
+				-	These components may be bundled and can be loaded on demand, this can be done by the frontend, by loading the components.
+				-	Webpack is a software which analyzes the source code on the server and bundles it as well as processes it. That way components can be bundled and provided. Additional this provides a fancy way to define components in single files. The code to load components will be generated by Webpack. Yay, less programming less mistakes.
+
+				Transfered everything to new backend
+				-	With the new backend a new website structure has been created. The old pages had been transfered to the correct positions in the new backend.
+				-	Now that the backend is working, the frontend may be developed.
+
+				Update for the devblog
+				-	The Development Blog got a new \"design\" and finally an update to its content.
+				-	One variable holds all the entries and will be parsed into a Vue entries array which are automatically visible when added.
+
+				Update introductions
+				-	Startpage and Devblog have been rewritten
+				';
+
+			$t = explode("\n", $blog);
+			$entries = [];
+			$entry['title'] = trim($t[1]);
+
+			for ($i = 2; $i < sizeof($t) - 1; $i++) {
+				$line = trim($t[$i]);
+				if($line === '') {
+					continue;
+				}
+
+				if($line[0] === '-') {
+					$line = trim(substr($line, 1));
+					$entry['paragraphs'][] = $line;
+				} else {
+					$entries[] = $entry;
+					$entry['paragraphs'] = [];
+					$entry['title'] = $line;
+				}
+			}
+
+			return $response->withJson($entries);
+		}
+
 		public static function getRoutes(): array {
 			return [
 				new Route('GET', '/soos', 'soos'),
 				new Route('GET', '/error', 'error'),
+				new Route('GET', '/devblog', 'devblog'),
 			];
 		}
 	}