Node Express服务器无法获取“ /”

时间:2018-12-30 21:27:19

标签: javascript express get

const https = require("http");
const app= require('./app');

const port =  8080;

const server = https.createServer(app);

server.listen(port)

1 个答案:

答案 0 :(得分:2)

我不确定您要做什么,但是您可以通过以下方式使用express:

var express = require('express')
var app = express()

app.get('/', function (req, res) {
  /// do something here
})

app.listen(8080)

此外,请查看快速指南:http://expressjs.com/en/starter/hello-world.html