标签:end stat class var html 分享 content data adf
var express = require(‘express‘); var http = require(‘http‘); var fs = require(‘fs‘); var app = express(); var path = require(‘path‘); app.use(express.static(path.join(__dirname, ‘public‘))); app.get(‘/login1‘, function(req, res, next) { res.writeHead(200,{‘Content-Type‘:‘text/html‘}) fs.readFile(‘./html/1.html‘,‘utf-8‘,function(err,data){ if(err){ throw err ; } res.end(data); }); }); app.listen(5000); console.log("监听端口 5000");
nodejs express 路由并显示html以及访问静态资源设置
标签:end stat class var html 分享 content data adf
原文地址:https://www.cnblogs.com/hcfan/p/9315636.html