简体   繁体   English

正斜杠在app.get('/',function(){…})中意味着什么? 在express.js中?

[英]What does the forward slash mean in app.get('/',function(){…}); in express.js?

我刚刚开始学习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 . 假设您在本地主机端口8080上运行服务器。那么服务器的 URL是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. 当有人将HTTP GET发送到http:// localhost:8080时 ,我将“ hi”登录到控制台。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM