Tre*_*ent 4 html javascript node.js express
好的,这是我的问题:我有一个我很满意的 HTML 页面,但我希望让它变得动态。我正在使用 Node 和 Express,我想知道是否有任何方法可以修改然后呈现纯 HTML。我不会使用 Jade 或任何其他模板引擎。
我的 server.js:
var http = require('http');
var express = require('express');
var app = express()
var port = 3000;
var api_router = express.Router();
....
api_router.route('/webm/test/')
.get(function(req, res){
res.sendFile(__dirname + "/test.html")
})
app.use('/api/', api_router);
app.listen(port);
console.log("NodeJS Backend API running.");
Run Code Online (Sandbox Code Playgroud)
目前这不起作用(没有找到 HTML 的模板引擎)。它也不能满足我的需求:我希望根据 GET 请求在标签中设置“src='blah.webm'”。
这是我要修改的页面:
<!DOCTYPE html>
<html>
<head>
<title>Index</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" type="text/css" href="../stylesheet.css">
<link rel="stylesheet" type="text/css" href="stylesheet.css">
</head>
<body>
<div id="header">
<a href="../index.html"><p>../</p></a>
<p>TrentV.net : Trent VanSlyke</p>
</div>
<div class="container" style="display: flex">
<video id="player" src="CUSTOMIZE ME" controls></video>
<div id="related">
</div>
<script src="webm.js" type="text/javascript"></script>
</div>
</body>
</html>
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
30324 次 |
| 最近记录: |