Skip to content

Instantly share code, notes, and snippets.

@whoeverest
Forked from kexoth/ConnectBoiler.js
Last active August 29, 2015 13:56
Show Gist options
  • Save whoeverest/9294422 to your computer and use it in GitHub Desktop.
Save whoeverest/9294422 to your computer and use it in GitHub Desktop.
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