2024-05-12 21:47:06 发布
网友
我用JavaScript构建了一个服务器,当你连接到它时,它会显示一个网页。服务器在连接时使用发送了htm文件
app.get('/', function (req, res) { res.sendfile('index.htm'); });
Python中有类似的函数吗
import SimpleHTTPServer import SocketServer PORT = 8000 Handler = SimpleHTTPServer.SimpleHTTPRequestHandler httpd = SocketServer.TCPServer(("", PORT), Handler) print "serving at port", PORT httpd.serve_forever()
见https://docs.python.org/2/library/simplehttpserver.html
见https://docs.python.org/2/library/simplehttpserver.html
相关问题 更多 >
编程相关推荐