App.get (name) vs app.get (path, [callback ...], callback) in Express

I'm new to Express, from the API docs it seems that we have two methods app.get()for getting the value of a variable, the other of us are familiar with HTTP GET request processing.

What is the difference between the two? How does Express know which one we want? Are they really the same function?

+4
source share
2 answers

This is the same function. expressdecides what to do based on the call.

The code get()starts with:

if (1 == arguments.length) ...

get(name), set(); , .

+3

. 1 == arguments.length 1, , .

set() get() .

+1

Source: https://habr.com/ru/post/1529261/


All Articles