V
V
Vlad Timofeev2015-01-07 23:41:40
Node.js
Vlad Timofeev, 2015-01-07 23:41:40

How to set all getam one parameter?

app.get(' someWay ', 
callback);

What should be put instead of someWay to catch any get request?

Answer the question

In order to leave comments, you need to log in

3 answer(s)
T
Timur Shemsedinov, 2015-01-08
@PyTiMa

If you are going to catch any get request, then you do not need express at all, http.createServer(function (req, res) { /* any request will get here */ }).listen(80); And express app.get('*', function (req, res) { /* any request will get here */ });

F
Finnish, 2015-01-08
@finnish

app.get('*', callback);

I
inker, 2015-01-08
@inker

It is possible like this:

app.use(function(req, res, next) {
  // next() вызывает следующий обработчик
});

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question