Javascript Python显示连接到服务器上的网页
我使用JavaScript构建了一个服务器,当您连接到它时,它会显示一个网页。服务器在连接时使用发送了htm文件Javascript Python显示连接到服务器上的网页,javascript,python,sendfile,Javascript,Python,Sendfile,我使用JavaScript构建了一个服务器,当您连接到它时,它会显示一个网页。服务器在连接时使用发送了htm文件 app.get('/', function (req, res) { res.sendfile('index.htm'); }); Python中有类似的函数吗 import SimpleHTTPServer import SocketServer PORT = 8000 Handler = SimpleHTTPServer.SimpleHTTPRequestHandl
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()
看