| | |
| | | <link rel="stylesheet" href="dist/theme/night-custom.css"> |
| | | |
| | | <!-- Theme used for syntax highlighted code --> |
| | | <link rel="stylesheet" href="plugin/highlight/monokai.css"> |
| | | <link rel="stylesheet" href="./node_modules/highlight.js/styles/atom-one-dark-reasonable.css"> |
| | | </head> |
| | | <body> |
| | | <div class="reveal"> |
| | |
| | | <h3>Grundlagen</h3> |
| | | <ul> |
| | | <li>HTML/CSS/JS</li> |
| | | <li>JSON</li> |
| | | <li>HTTP-Protokoll</li> |
| | | <li>Debugger</li> |
| | | <li>JSON</li> |
| | | </ul> |
| | | </section> |
| | | <section> |
| | | <h3>Fortgeschrittenes</h3> |
| | | <ul> |
| | | <li>NodeJS</li> |
| | | <li>JavaScript</li> |
| | | <li>Responsive Design</li> |
| | | <li>CSS-Animationen</li> |
| | | <li>NodeJS</li> |
| | | <li>WebComponents / lit</li> |
| | | <li>Canvas-Element</li> |
| | | <li>Datenbank</li> |
| | | </ul> |
| | | </section> |
| | |
| | | <section> |
| | | <h3>Interessante Technologien</h3> |
| | | <ul> |
| | | <li>Canvas-Element</li> |
| | | <li>CSS-Animationen</li> |
| | | <li>WebSockets</li> |
| | | <li>WebWorker</li> |
| | | <li>ServiceWorker</li> |
| | |
| | | </section> |
| | | <section> |
| | | <ul> |
| | | <li>HyperText Markup Language</li> |
| | | <li>Erste Version 1993 von Tim Berners-Lee</li> |
| | | <li>Dokumentationsmedium</li> |
| | | <li>Ursprünglich rein akademische Verwendung</li> |
| | | <li>Verlinkungen der Dokumente macht sie "hyper"</li> |
| | | </ul> |
| | | </section> |
| | | <section> |
| | |
| | | <section> |
| | | <h3>Grundgerüst</h3> |
| | | <pre> |
| | | <code data-trim data-line-numbers> |
| | | <code class="html" data-trim data-line-numbers> |
| | | <script type="text/template"> |
| | | <!DOCTYPE html> |
| | | <html lang="de"> |
| | |
| | | </pre> |
| | | </section> |
| | | <section> |
| | | <h3>Grundgerüst</h3> |
| | | <pre> |
| | | <code data-trim data-line-numbers> |
| | | <script type="text/template"> |
| | | <div>Inhalt</div> |
| | | </script> |
| | | </code> |
| | | </pre> |
| | | </section> |
| | | <section> |
| | | <h3>Beispiel</h3> |
| | | <pre> |
| | | <code data-trim data-line-numbers> |
| | | <code class="html" data-trim data-line-numbers> |
| | | <script type="text/template"> |
| | | <!DOCTYPE html> |
| | | <html lang="de"> |
| | | <html lang="en"> |
| | | <head> |
| | | <meta charset="UTF-8"> |
| | | <title>Title</title> |
| | | </head> |
| | | <body> |
| | | <h1>Überschrift</h1> |
| | | <h1>Lorem Ipsum</h1> |
| | | <div> |
| | | <p>Dies ist ein Paragraph</p> |
| | | <p>Dies ist noch ein Paragraph mit einem längeren Text</p> |
| | | <p>Lorem ipsum dolor sit amet, consectetuer adipiscing</p> |
| | | <a href="/assets/html/simple2.html">Weitere Infos</a> |
| | | </div> |
| | | </body> |
| | | </html> |
| | |
| | | </section> |
| | | <section> |
| | | <h3>Beispiel</h3> |
| | | <iframe data-src="/assets/html/simple.html"></iframe> |
| | | </section> |
| | | <section> |
| | | <h3>Aufbau eines Elements</h3> |
| | | <pre> |
| | | <code> |
| | | <h1>Überschrift</h1> |
| | | <div> |
| | | <p>Dies ist ein Paragraph</p> |
| | | <p>Dies ist noch ein Paragraph mit einem längeren Text</p> |
| | | </div> |
| | | <code class="html" data-trim> |
| | | <script type="text/template"> |
| | | <span id="my-id" class="super important">Inhalt</span> |
| | | </script> |
| | | </code> |
| | | </pre> |
| | | <pre> |
| | | <code class="html" data-trim> |
| | | <script type="text/template"> |
| | | <!-- HTML 4.01 --> |
| | | <input id="input" class="super important" disabled="disabled" /> |
| | | </script> |
| | | </code> |
| | | </pre> |
| | | <pre> |
| | | <code class="html" data-trim> |
| | | <script type="text/template"> |
| | | <!-- HTML 5 --> |
| | | <input id="input2" class="super important" disabled> |
| | | </script> |
| | | </code> |
| | | </pre> |
| | | </section> |
| | | </section> |
| | | <section> |
| | | <section> |
| | | <h2>CSS</h2> |
| | | </section> |
| | | <section> |
| | | <ul> |
| | | <li>Cascading Style Sheet</li> |
| | | <li>Nach größerer Verbreitung von HTML</li> |
| | | <li>Webseiten ansprechend gestalten</li> |
| | | </ul> |
| | | </section> |
| | | <section> |
| | | <img data-src="/assets/images/css-sucks.png"> |
| | | </section> |
| | | <section> |
| | | <h3>Beispiel</h3> |
| | | <pre> |
| | | <code class="css" data-trim data-line-numbers> |
| | | selector [, selector, selector, ...] { |
| | | property: value; |
| | | } |
| | | </code> |
| | | </pre> |
| | | </section> |
| | | <section> |
| | | <h3>Beispiel</h3> |
| | | <pre> |
| | | <code class="css" data-trim data-line-numbers> |
| | | html { |
| | | background-color: red; |
| | | font-size: 30px; |
| | | } |
| | | </code> |
| | | </pre> |
| | | </section> |
| | | <section> |
| | | <h3>Beispiel</h3> |
| | | <pre> |
| | | <code class="html" data-trim data-line-numbers> |
| | | <script type="text/template"> |
| | | <html lang="en"> |
| | | <head> |
| | | ... |
| | | <style> |
| | | html { |
| | | background-color: red; |
| | | font-size: 30px; |
| | | } |
| | | </style> |
| | | </head> |
| | | <body> |
| | | ... |
| | | </body> |
| | | </html> |
| | | </script> |
| | | </code> |
| | | </pre> |
| | | </section> |
| | | <section> |
| | | <h3>Beispielhafte CSS-Eigenschaften</h3> |
| | | <ul> |
| | | <li>background-color: red</li> |
| | | <li>font-family: Georgia, serif, Arial</li> |
| | | <li>text-decoration: line-through underline</li> |
| | | </ul> |
| | | </section> |
| | | <section> |
| | | <h3>Selektoren</h3> |
| | | <ul> |
| | | <li>Umfangreiche Element-Selektoren zur Anwendung der Styles</li> |
| | | <li>Kinder, Enkel...</li> |
| | | <li>Geschwister, direkte Nachfolger</li> |
| | | <li>Attribute</li> |
| | | <li>Pseudoklassen</li> |
| | | </ul> |
| | | </section> |
| | | <section> |
| | | <h3>Selektoren</h3> |
| | | <pre> |
| | | <code class="css" data-trim data-line-numbers> |
| | | #my-id /* ID */ |
| | | html, body /* Mehrfachselektion */ |
| | | div > p /* p die direkt unterhalb eines div sind */ |
| | | div p /* p die irgendwo unterhalb eines div sind */ |
| | | a:visited /* besuchte Links */ |
| | | div:hover /* divs über die man mit der Maus fährt */ |
| | | span.important /* span mit der Klasse "important" */ |
| | | </code> |
| | | </pre> |
| | | </section> |
| | | <section> |
| | | <h3>Layout</h3> |
| | | <p>Es gibt zwei grundlegende Blocktypen:</p> |
| | | <p><code>block</code></p> |
| | | <p><code>inline</code></p> |
| | | </section> |
| | | <section> |
| | | <h3>Block</h3> |
| | | <p>Beansprucht eine ganze Zeile und verursacht Zeilenumbrüche</p> |
| | | <pre> |
| | | <code class="css" data-trim data-line-numbers> |
| | | display: block; |
| | | </code> |
| | | </pre> |
| | | </section> |
| | | <section> |
| | | <p>Kann Breite und Höhe haben</p> |
| | | <pre> |
| | | <code class="css" data-trim data-line-numbers> |
| | | display: block; |
| | | width: 20px; |
| | | height: 20px; |
| | | </code> |
| | | </pre> |
| | | </section> |
| | | <section> |
| | | <h3>Inline</h3> |
| | | <p>Wie einfacher Text, der mit anderen in der gleichen Zeile stehen kann</p> |
| | | <pre> |
| | | <code class="css" data-trim data-line-numbers> |
| | | display: inline; |
| | | </code> |
| | | </pre> |
| | | </section> |
| | | <section> |
| | | <p>Festlegen von Breite und Höhe sind wirkungslos</p> |
| | | <pre> |
| | | <code class="css" data-trim data-line-numbers> |
| | | display: inline; |
| | | width: 20px; /* kein Effekt */ |
| | | height: 20px; /* kein Effekt */ |
| | | </code> |
| | | </pre> |
| | | </section> |
| | | <section> |
| | | <h3>Inline-Block</h3> |
| | | <p>Mischform von <code>inline</code> und <code>block</code></p> |
| | | <pre> |
| | | <code class="css" data-trim data-line-numbers> |
| | | display: inline-block; |
| | | width: 20px; |
| | | height: 20px; |
| | | </code> |
| | | </pre> |
| | | </section> |
| | | <section> |
| | | <h3>Spezifität</h3> |
| | | <p>Regeln können andere Regeln überschreiben</p> |
| | | <pre> |
| | | <code class="html" data-trim data-line-numbers> |
| | | <script type="text/template"> |
| | | <div style="display: inline-block"></div> |
| | | </script> |
| | | </code> |
| | | </pre> |
| | | <pre> |
| | | <code class="css" data-trim data-line-numbers> |
| | | #id:hover { display: none } |
| | | |
| | | #id { display: block } |
| | | |
| | | .class.clazz { display: inline } |
| | | |
| | | div { display: inline-block } |
| | | </code> |
| | | </pre> |
| | | </section> |
| | | <section> |
| | | <h3>Box Model</h3> |
| | | <p>Es gibt zwei Varianten des Modells:</p> |
| | | <p><code>content-box</code> (default)</p> |
| | | <p>border-box</p> |
| | | <pre> |
| | | <code class="css" data-trim data-line-numbers> |
| | | box-sizing: content-box; |
| | | box-sizing: border-box; |
| | | </code> |
| | | </pre> |
| | | </section> |
| | | <section> |
| | | <img data-src="/assets/images/css-box-model.png"> |
| | | </section> |
| | | <section> |
| | | <h3>Beispiel</h3> |
| | | <pre> |
| | | <code class="css" data-trim data-line-numbers> |
| | | div { |
| | | border: 3px solid red; |
| | | padding: 10px; |
| | | width: 100px; |
| | | } |
| | | |
| | | .border-box { |
| | | box-sizing: border-box; |
| | | } |
| | | |
| | | .content-box { |
| | | box-sizing: content-box; |
| | | } |
| | | </code> |
| | | </pre> |
| | | <pre> |
| | | <code class="html" data-trim data-line-numbers> |
| | | <script type="text/template"> |
| | | <div class="content-box">content-box</div> |
| | | <div class="border-box">border-box</div> |
| | | </script> |
| | | </code> |
| | | </pre> |
| | | </section> |
| | | <section> |
| | | <h3>Beispiel</h3> |
| | | <iframe data-src="/assets/html/box-sizing.html"></iframe> |
| | | </section> |
| | | <section> |
| | | <h3>Positioning</h3> |
| | | <pre> |
| | | <code class="css" data-trim data-line-numbers> |
| | | /* default, da wo es in der Seite steht */ |
| | | position: static; |
| | | /* relativ zu seiner eigentlichen Position */ |
| | | position: relative; |
| | | /* relativ zu seinem nächsten non-static parent o. window */ |
| | | position: absolute; |
| | | </code> |
| | | </pre> |
| | | </section> |
| | | <section> |
| | | <pre> |
| | | <code class="css" data-trim data-line-numbers> |
| | | position: relative; |
| | | position: absolute; |
| | | </code> |
| | | </pre> |
| | | <p>erlauben Verschiebung mittels</p> |
| | | <pre> |
| | | <code class="css" data-trim data-line-numbers> |
| | | top: 10px; |
| | | left: 10px; |
| | | right: 10px; |
| | | bottom: 10px; |
| | | </code> |
| | | </pre> |
| | | </section> |
| | | <section> |
| | | <h3>Beispiel Menü</h3> |
| | | <iframe data-src="/assets/html/css-menu.html"></iframe> |
| | | </section> |
| | | <section> |
| | | <pre> |
| | | <code class="css" data-trim data-line-numbers> |
| | | .menu-item { |
| | | display: inline-block; |
| | | |
| | | position: relative; |
| | | } |
| | | |
| | | .menu-item .children { |
| | | display: none; |
| | | |
| | | position: absolute; |
| | | } |
| | | |
| | | .menu-item:hover .children { |
| | | display: block; |
| | | } |
| | | </code> |
| | | </pre> |
| | | </section> |
| | | <section> |
| | | <pre> |
| | | <code class="html" data-trim data-line-numbers> |
| | | <script type="text/template"> |
| | | <div class="menu"> |
| | | <div class="menu-item">Eins</div> |
| | | <div class="menu-item"> |
| | | Hover Me! |
| | | <div class="children"> |
| | | <div>Item 1</div> |
| | | <div>Item 2</div> |
| | | </div> |
| | | </div> |
| | | <div class="menu-item">Drei</div> |
| | | </div> |
| | | </script> |
| | | </code> |
| | | </pre> |
| | | </section> |
| | | </section> |
| | | <section> |
| | | <section> |
| | | <h2>JS</h2> |
| | | </section> |
| | | <section> |
| | | <ul> |
| | | <li>JavaScript stammt aus dem Jahr 1995 von Netscape</li> |
| | | <li>Syntaktisch an Java angelehnt</li> |
| | | <li>Ursprünglich nur optionale, verzichtbare Effekte (unobstrusive)</li> |
| | | <li>Mittlerweile von ECMA standardisiert</li> |
| | | </ul> |
| | | </section> |
| | | <section> |
| | | <table> |
| | | <tr><th>Version</th><th>ECMA Standard</th><th>Jahr</th></tr> |
| | | <tr><td>ES1</td><td>ECMAScript 1</td><td>1997</td></tr> |
| | | <tr><td>ES2</td><td>ECMAScript 2</td><td>1998</td></tr> |
| | | <tr><td><strong>ES3</strong></td><td><strong>ECMAScript 3</strong></td><td><strong>1999</strong></td></tr> |
| | | <tr><td><strong>ES5</strong></td><td><strong>ECMAScript 5</strong></td><td><strong>2009</strong></td></tr> |
| | | <tr><td>ES6</td><td>ECMAScript 2015</td><td>2015</td></tr> |
| | | <tr><td></td><td>...</td><td></td></tr> |
| | | <tr><td></td><td>ECMAScript 2020</td><td>2020</td></tr> |
| | | </table> |
| | | </section> |
| | | <section> |
| | | <p>Code wird zwischen <code>script</code>-Tags geschrieben</p> |
| | | <pre> |
| | | <code class="html" data-trim data-line-numbers> |
| | | <!DOCTYPE html> |
| | | <html lang="de"> |
| | | <head> |
| | | <meta charset="UTF-8"> |
| | | </head> |
| | | <body> |
| | | <script>// code</script> |
| | | </body> |
| | | </html> |
| | | </code> |
| | | </pre> |
| | | </section> |
| | | <section> |
| | | <p>DOM-API</p> |
| | | <pre> |
| | | <code class="js" data-trim data-line-numbers> |
| | | // findet das erste Element |
| | | const parent = document.querySelector("#id"); |
| | | |
| | | // findet alle Elemente |
| | | const elements = document.querySelectorAll("#id"); |
| | | |
| | | // Element erstellen |
| | | const newElement = document.createElement("div"); |
| | | |
| | | newElement.addEventListener("click", (event) => { |
| | | // Click-Event |
| | | }); |
| | | |
| | | // Element anhängen |
| | | parent.appendChild(newElement); |
| | | |
| | | newElement.remove(); |
| | | </code> |
| | | </pre> |
| | | </section> |
| | | </section> |
| | | <section> |
| | | <section> |
| | | <h2>Auslagern in verschiedene Dateien</h2> |
| | | </section> |
| | | <section> |
| | | <pre> |
| | | <code class="html" data-trim data-line-numbers> |
| | | <!DOCTYPE html> |
| | | <html> |
| | | <head> |
| | | <!-- CSS --> |
| | | <link href="styles.css" rel="stylesheet"> |
| | | </head> |
| | | <body> |
| | | <!-- JS --> |
| | | <script src="index.js"></script> |
| | | </body> |
| | | </html> |
| | | </code> |
| | | </pre> |
| | | </section> |
| | | <section> |
| | | <p>Parsen eines HTML-Dokuments</p> |
| | | <pre> |
| | | <code class="html" data-trim data-line-numbers="1|2|3|4|5|6|7|8|9|10"> |
| | | <script type="text/template"> |
| | | <!DOCTYPE html> |
| | | <html lang="de"> |
| | | <head> |
| | | <meta charset="UTF-8"> |
| | | <title>Coole Seite 😀</title> |
| | | </head> |
| | | <body> |
| | | <div>Ganz langer Text</div> |
| | | </body> |
| | | </html> |
| | | </script> |
| | | </code> |
| | | </pre> |
| | | </section> |
| | | <section> |
| | | <p>Verschiedene Varianten, JavaScript erst am Ende auszuführen</p> |
| | | <p>Damals mit jQuery:</p> |
| | | <pre> |
| | | <code class="html" data-trim data-line-numbers> |
| | | <!DOCTYPE html> |
| | | <html> |
| | | <head> |
| | | <script> |
| | | $(document).ready((event) => { |
| | | const element = document.querySelector("#hello"); |
| | | }); |
| | | </script> |
| | | </head> |
| | | <body> |
| | | <div id="hello">Hello World!</div> |
| | | </body> |
| | | </html> |
| | | </code> |
| | | </pre> |
| | | </section> |
| | | <section> |
| | | <p><code>script</code>-Tag am Ende</p> |
| | | <pre> |
| | | <code class="html" data-trim data-line-numbers> |
| | | <!DOCTYPE html> |
| | | <html> |
| | | <head> |
| | | </head> |
| | | <body> |
| | | <div>Hello World!</div> |
| | | ... |
| | | <script src="index.js"></script> |
| | | </body> |
| | | </html> |
| | | </code> |
| | | </pre> |
| | | </section> |
| | | <section> |
| | | <p>Event-basiert, z.B. per DOMContentLoaded</p> |
| | | <pre> |
| | | <code class="html" data-trim data-line-numbers> |
| | | <!DOCTYPE html> |
| | | <html> |
| | | <head> |
| | | <script> |
| | | document.addEventListener("DOMContentLoaded", (event) => { |
| | | // wird ausgeführt, sobald das Dokument geparst wurde |
| | | const element = document.querySelector("#hello"); |
| | | }); |
| | | </script> |
| | | </head> |
| | | <body> |
| | | <div id="hello">Hello World!</div> |
| | | </body> |
| | | </html> |
| | | </code> |
| | | </pre> |
| | | </section> |
| | | <section> |
| | | <p>Moderne Variante</p> |
| | | <pre> |
| | | <code class="html" data-trim data-line-numbers> |
| | | <script src="index.js" defer></script> |
| | | </code> |
| | | </pre> |
| | | </section> |
| | | <section> |
| | | <h2><code>document</code>-Operationen</h2> |
| | | <pre> |
| | | <code class="js" data-trim data-line-numbers> |
| | | document.open(); |
| | | document.write("<div>Booo!</div>"); |
| | | document.close(); |
| | | </code> |
| | | </pre> |
| | | </section> |
| | | <section> |
| | | <a href="https://developer.mozilla.org/en-US/docs/Web/API/Document/write"> |
| | | <img data-src="/assets/images/document.write.jpg"> |
| | | </a> |
| | | </section> |
| | | <section> |
| | | <pre> |
| | | <code class="html" data-trim data-line-numbers> |
| | | <body> |
| | | <script>document.write("<p>Dies ist ein Text.</p>")</script> |
| | | <button>Dunkle Magie</button> |
| | | <script> |
| | | const button = document.querySelector("button"); |
| | | |
| | | button.addEventListener("click", () => { |
| | | document.write("Und pfutsch!"); |
| | | }); |
| | | </script> |
| | | </body> |
| | | </code> |
| | | </pre> |
| | | </section> |
| | | </section> |
| | | <section> |
| | | <section> |
| | | <h2>HTTP-Protokoll</h2> |
| | | </section> |
| | | <section> |
| | | <img data-src="/assets/images/osi-model.jpg"> |
| | | </section> |
| | | <section> |
| | | <ul> |
| | | <li>OSI-Schichten 5, 6 und 7</li> |
| | | <li>Anfrage-Antwort-Prinzip</li> |
| | | <li>Basiert auf einfachem Text</li> |
| | | </ul> |
| | | </section> |
| | | <section> |
| | | <table> |
| | | <tr><th>Version</th><th>Jahr</th></tr> |
| | | <tr><th>0.9</th><th>1991</th></tr> |
| | | <tr><th>1.0</th><th>1996</th></tr> |
| | | <tr><th>1.1</th><th>1999</th></tr> |
| | | <tr><th>2.0</th><th>2015</th></tr> |
| | | <tr><th>3.0</th><th>2022</th></tr> |
| | | </table> |
| | | </section> |
| | | <section> |
| | | <p>Request an www.google.de</p> |
| | | <pre> |
| | | <code class="http" data-trim data-line-numbers> |
| | | GET / HTTP/1.1 |
| | | Host: www.google.de |
| | | User-Agent: curl/7.88.1 |
| | | Accept: */* |
| | | </code> |
| | | </pre> |
| | | </section> |
| | | <section> |
| | | <p>Response von www.google.de</p> |
| | | <pre> |
| | | <code class="http" data-trim data-line-numbers> |
| | | HTTP/1.1 200 OK |
| | | Date: Tue, 04 Apr 2023 15:45:26 GMT |
| | | Expires: -1 |
| | | Cache-Control: private, max-age=0 |
| | | Content-Type: text/html; charset=ISO-8859-1 |
| | | Content-Security-Policy-Report-Only: [...] |
| | | Server: gws |
| | | X-XSS-Protection: 0 |
| | | X-Frame-Options: SAMEORIGIN |
| | | Set-Cookie: [...] |
| | | Accept-Ranges: none |
| | | Vary: Accept-Encoding |
| | | Transfer-Encoding: chunked |
| | | |
| | | <!doctype html><html>...</html> |
| | | </code> |
| | | </pre> |
| | | </section> |
| | | <section> |
| | | <p>Einfach mal testen:</p> |
| | | <pre> |
| | | <code class="bash" data-trim data-line-numbers> |
| | | curl -v --http1.0 http://www.google.de |
| | | curl -v --http1.1 http://www.google.de |
| | | curl -v --http2 http://www.google.de |
| | | curl -v --http2-prior-knowledge http://www.google.de |
| | | curl -v --http3 http://www.google.de |
| | | </code> |
| | | </pre> |
| | | </section> |
| | | <section> |
| | | <p>Verschiedene "Verben" bzw. "Methoden"</p> |
| | | <ul> |
| | | <li>GET</li> |
| | | <li>POST</li> |
| | | <li>PUT</li> |
| | | <li>PATCH</li> |
| | | <li>DELETE</li> |
| | | <li>...</li> |
| | | </ul> |
| | | </section> |
| | | <section> |
| | | <p>Beispiel:</p> |
| | | <pre> |
| | | <code class="bash" data-trim data-line-numbers> |
| | | git clone https://git.furnco.de/r/public/web-development/examples.git |
| | | cd examples/templates/005-http-rest |
| | | node index.js |
| | | </code> |
| | | </pre> |
| | | </section> |
| | | <section> |
| | | <pre> |
| | | <code class="text" data-trim data-line-numbers> |
| | | curl -X GET -is http://localhost:3000/todo |
| | | curl -X POST -H "Content-Type: application/json" -d '{"name": "Einkaufen"}' -is http://localhost:3000/todo |
| | | curl -X POST -H "Content-Type: application/json" -d '{"name": "Putzen"}' -is http://localhost:3000/todo |
| | | curl -X PUT -H "Content-Type: application/json" -d '{"name": "Schlafen"}' -is http://localhost:3000/todo/1 |
| | | curl -X DELETE -is http://localhost:3000/todo/0 |
| | | </code> |
| | | </pre> |
| | | </section> |
| | | <section> |
| | | <pre> |
| | | <code class="text" data-trim data-line-numbers> |
| | | HTTP/1.1 200 OK |
| | | X-Powered-By: Express |
| | | Content-Type: application/json; charset=utf-8 |
| | | Content-Length: 13 |
| | | ETag: W/"d-KMmUcQ1kigqtwzZnU+jVDkYP3Co" |
| | | Date: Wed, 05 Apr 2023 12:05:05 GMT |
| | | Connection: keep-alive |
| | | Keep-Alive: timeout=5 |
| | | |
| | | ["Einkaufen"] |
| | | </code> |
| | | </pre> |
| | | </section> |
| | | <section> |
| | | <pre> |
| | | <code class="js" data-trim data-line-numbers=""> |
| | | app.get("/todo", (req, res) => { |
| | | return res.json(todos); |
| | | }); |
| | | |
| | | // [...] |
| | | |
| | | app.post("/todo", (req, res) => { |
| | | // [...] |
| | | return res.json(todos); |
| | | // [...] |
| | | }); |
| | | </code> |
| | | </pre> |
| | | </section> |
| | | <section> |
| | | <p><code>GET</code> und <code>POST</code> auf klassischen Webseiten</p> |
| | | <pre> |
| | | <code class="html" data-trim data-line-numbers> |
| | | <form method="post" action="/todo"> |
| | | <input name="todo"><button>add</button> |
| | | </form> |
| | | </code> |
| | | </pre> |
| | | <p>Beispiel:</p> |
| | | <pre> |
| | | <code class="bash" data-trim data-line-numbers> |
| | | cd examples/templates/006-http-web |
| | | node index.js |
| | | </code> |
| | | </pre> |
| | | </section> |
| | | </section> |
| | | <section> |
| | | <section> |
| | | <h3>JSON</h3> |
| | | </section> |
| | | <section> |
| | | <ul> |
| | | <li><em class="h">J</em>ava<em class="h">S</em>cript <em class="h">O</em>bject <em class="h">N</em>otation</li> |
| | | <li>Basiert auf reinem Text</li> |
| | | <li>Format zur strukturierten Speicherung von Daten</li> |
| | | <li>Attribute müssen immer in doppelte Anführungsstriche (<code>"</code>) gesetzt werden</li> |
| | | </ul> |
| | | </section> |
| | | <section> |
| | | <p>Definition eines einfachen Objekts in JS</p> |
| | | <pre> |
| | | <code class="js" data-trim data-line-numbers> |
| | | const o = { |
| | | x: 1, |
| | | y: 2 |
| | | }; |
| | | </code> |
| | | </pre> |
| | | </section> |
| | | <section> |
| | | <p>Entsprechung in JSON</p> |
| | | <pre> |
| | | <code class="js" data-trim data-line-numbers> |
| | | { |
| | | "x": 1, |
| | | "y": 2 |
| | | } |
| | | </code> |
| | | </pre> |
| | | </section> |
| | | <section> |
| | | <p>Mögliche Typen</p> |
| | | <p> |
| | | <ul> |
| | | <li>Number (bzw. Integer / Float)</li> |
| | | <li>Boolean</li> |
| | | <li>String</li> |
| | | <li>Array</li> |
| | | <li>Object</li> |
| | | </ul> |
| | | </p> |
| | | </section> |
| | | <section> |
| | | <p>Der äußere Container kann ein Array oder ein Object sein</p> |
| | | <pre> |
| | | <code class="js" data-trim data-line-numbers> |
| | | { |
| | | "key": "value", |
| | | } |
| | | </code> |
| | | </pre> |
| | | <pre> |
| | | <code class="js" data-trim data-line-numbers> |
| | | [ |
| | | "foo", |
| | | "bar" |
| | | ] |
| | | </code> |
| | | </pre> |
| | | </section> |