Node.js/Express.js App Only Works on Port 3000

后端 未结 16 2207
暖寄归人
暖寄归人 2020-12-12 13:23

I have a Node.js/Express.js app running on my server that only works on port 3000 and I\'m trying to figure out why. Here\'s what I\'ve found:

  • Without specifyi
16条回答
  •  执念已碎
    2020-12-12 14:09

    If you want to show something you're connected on 3000

    var express = require('express')
    var app = express()
    
    app.get('/', function (req, res) {
      res.send('Hello World!')
    })
    
    app.listen(3000, function () {
      console.log('Example app listening on port 3000!')
    })
    

    I hope that will be helpful to you

提交回复
热议问题