-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
3061c88
commit 0ecc5f0
Showing
3 changed files
with
743 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
// express und http Module importieren. Sie sind dazu da, die HTML-Dateien | ||
// aus dem Ordner "public" zu veröffentlichen. | ||
var express = require("express"); | ||
const cookieParser = require("cookie-parser"); | ||
|
||
const app = express(); | ||
app.use(cookieParser()); | ||
|
||
var server = require("http").createServer(app); | ||
var port = 3000; | ||
|
||
server.listen(port, function () { | ||
console.log("Server listening on port " + port); | ||
}); | ||
|
||
app.get("/list", (req, res, next) => { | ||
res.json(["Tony", "Lisa", "Michael", "Ginger", "Food"]); | ||
}); | ||
|
||
app.get("/inc", (req, res, next) => { | ||
var inc = parseInt(req.cookies["inc"]); | ||
if (isNaN(inc)) { | ||
inc = 0; | ||
} | ||
res.cookie("inc", ++inc, { maxAge: 10800 }).send("cookie set to" + inc); | ||
}); |
Oops, something went wrong.