Jede Anfrage besteht aus asynchrone und synchrone Umsetzung.
4. // Load HTTP module
5. const http = require("http");
6. const hostname = "127.0.0.1";
7. const port = 5000;
8. // Create HTTP server
9. const server = http.createServer(function(req, res) {
10. // Set the response HTTP header with HTTP status and Content type
11. res.writeHead(200, {'Content-Type': 'text/plain'});
12. // Send the response body "Hello World"
13. res.end('Hello World\n');
14. });
15.
16. // Prints a log once the server starts listening
17. server.listen(port, hostname, function() {
18. console.log(`Server running at http://${hostname}:${port}/`);
19. })
4. Speichern Sie die Datei in den Ordner 5. Gehen Sie zurück zum Terminal und geben Sie folgenden Befehl ein: Code: node hello.js 6. Schlussendlich, navigieren Sie zu http://localhost:5000 auf Ihrem Webbrowser. Auf Ihrer sonst leeren Webseite sollte nun „Hello World“ in der oberen linken Ecke stehen. Wenn Sie Ihren eigenen Webshop aufbauen möchten oder Fragen zu E-Commerce-Entwicklungsplattformen oder Apps haben, lesen Sie unsere Blogbeiträge für Shopify und Shopware. Unser engagiertes Outsourcing-Team kann Ihr Mitarbeiter im E-Commerce sein.