Answer the question
In order to leave comments, you need to log in
What are the mappings in express?
The route path below maps acd to abcd.
app.get('/ab?cd', function(req, res) {
res.send('ab?cd');
});
This route path matches abcd, abbcd, abbbcd, and so on.
app.get('/ab+cd', function(req, res) {
res.send('ab+cd');
});
This route path matches abcd, abxcd, abRABDOMcd, ab123cd, and so on.
app.get('/ab*cd', function(req, res) {
res.send('ab*cd');
});
This route path maps /abe and /abcde.
app.get('/ab(cd)?e', function(req, res) {
res.send('ab(cd)?e');
});
I can not understand what kind of comparisons, and what are they for?
Answer the question
In order to leave comments, you need to log in
This is standard routing. You follow a URL like mysite.com/abe or mysite.com/abcde , what will the server give you? That's right, what you have specified inside the "comparable" route, in the case of this example, this is your last case:
app.get('/ab(cd)?e', function(req, res) {
res.send('ab(cd)?e'); // здесь может быть что-нибудь, например: покажи страницу с такой-то картинкой
});
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question