我刚刚开始学习express.js,在那我们做app.get('/'。function(){...});,我想知道那是什么意思。我试图研究Google,但实际上无法获得,而不会过于技术化就可以简单地描述它。
Lets say you're running your server on localhost port 8080. Then the root URL of your server is http://localhost:8080 .
Thus when you write
app.get('/', function(request, response) {
console.log('hi');
})
You're saying
When someone sends an HTTP GET to http://localhost:8080 , I log "hi" into the console.
/
means just your root URL
/example
in contrast would mean http://localhost:8080/example function(){}
is what you want to do in response
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.