如何解决使用express / node.js启动服务器时出错遵循The Coding Train YouTube教程
此网站上还有其他一些类似的问题,但没有一个可以专门帮助我。
这是我正在关注的视频2.1 Server-side with Node.js - Working with Data and APIs in JavaScript
的链接视频中15:17时出现错误
1。。获取http:// localhost:3000/404(未找到)
2。。拒绝加载图像“ http:// localhost:3000 / favicon.ico”,因为它违反了以下内容安全策略指令:“ default-src'none'”。请注意,未明确设置“ img-src”,因此将“ default-src”用作备用。
信用:“编码火车”
下面的javascript
/// index.js ///
const express = require('express');
const app = express();
app.listen(3000,() => console.log('listening at 3000'));
app.use(express.static('public'));
html下方的 public
文件夹中/// tutorial_2_1.html ///
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width,initial-scale=1.0" />
<meta http-equiv="X-UA-Compatible" content="ie=edge" />
<title>Document</title>
</head>
<body>
<h1>Data Selfie App</h1>
<p>Hello?</p>
</body>
</html>
node_modules文件夹也在我的目录中。
这是我的第一个问题,任何建议将不胜感激。
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。