所以..从这个Youtube教程:https://www.youtube.com/watch?v =NA21dUBfJhw&list=PL4cUxeGkcC9gcy9lrvMJ75z9maRw4byYp&index=33 我得到了一些“doto-list”的代码。问题是教程人员只进行了本地托管,而我正在尝试通过 Firebase 将其实际托管在实际网页上。所以我所做的就是在顶部添加 constfunctions = require('firebase-functions') 并添加exports.app =functions.https.onRequest((request,response) => {response.send("Hello from Firebase!" )在底部,我在实际网页上得到的唯一结果是“Hello from Firebase!”。有没有办法让整个“todo-list”程序在我的实际网页上运行?
索引.js
const functions = require('firebase-functions');
var express = require('express');
var app = express();
var todoController = require('./todoController');
app.set('view engine', 'ejs');
app.use(express.static('./'));
todoController(app);
exports.app = functions.https.onRequest((request, response) => {
response.send("Hello from Firebase!");
});
Run Code Online (Sandbox Code Playgroud)
待办事项.ejs
<html>
<head>
<title>Todo List</title>
<script
src="https://code.jquery.com/jquery-3.4.1.min.js"
integrity="sha256-
CSXorXvZcTkaix6Yvo6HppcZGetbYMGWSFlBw8HfCJo="
crossorigin="anonymous"></script>
<script src="./assets/todo-list.js"></script>
<link href="./assets/styles.css" rel="stylesheet"
type="text/css">
</head>
<body>
<div id="todo-table">
<form>
<input type="text" name="item" placeholder="Add new
item..." required />
<button …Run Code Online (Sandbox Code Playgroud)