source: vorlesung/code/VL08-rest_express/hello1.js @ 133

Last change on this file since 133 was 133, checked in by tr, 7 years ago

VL Express / REST Demo

File size: 523 bytes
Line 
1// HTTP Modul einbinden
2var http = require("http");
3
4// Express einbinden
5var express = require("express");
6// Express-App erzeugen
7var app = express();
8
9// HTTP Server erzeugen
10var server = http.createServer(app);
11
12// Server an Port binden
13server.listen(3000);
14
15// Handler für GET-Requests
16// * ist die Route und kennzeichnet hier, dass GET-Requests für
17// alle URLs (Routen) angenommen werden
18app.get("*", function(req, res) {
19    res.contentType("text/html");
20    res.status(200).send("Hello World");
21});
Note: See TracBrowser for help on using the repository browser.