-
-
Save whoeverest/9294422 to your computer and use it in GitHub Desktop.
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
var express = require('express'); | |
var app = express(); | |
var activeState = "0"; | |
function delayedResponse(req, res, next) { | |
// сите функции со req, res, next можат да бидат middleware | |
// во express, тоа е закон. глеј доле како ја користам | |
var random = 123; | |
setTimeout(next); | |
} | |
app.get('/', delayedResponse, function(req, res) { | |
if (req.query.id) | |
activeState = req.query.id; // овде мењам, само /?3 е безвезе pattern | |
res.end(activeState); | |
}) | |
app.listen(8080); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment