[英]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”登录到控制台。
/
means just your root URL /
表示您的根网址
/example
in contrast would mean http://localhost:8080/example /example
相反,则表示http:// localhost:8080 / example function(){}
is what you want to do in response function(){}
是您想做的回应
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.