操作步骤

  1. 发现hexo评论不管用了,说明有可能数据库被关闭了,https://cloud.mongodb.com/
    • 打开网址检查是否关闭。如果关闭重新打开,并且创建新的用户。
    • 然后复制链接 例子:mongodb+srv://ban:<db_password>@cluster0.eukfmxs.mongodb.net/?retryWrites=true&w=majority&appName=Cluster0
    • ban和db_password改为新创建的用户
  2. 打开 https://vercel.com/
  3. 重新部署

截图如下:

描述

主要用到下边3个:

  1. Twikoo官网:https://twikoo.js.org/backend.html
  2. Vercel官网:https://vercel.com/
  3. 数据库mongodb官网:https://cloud.mongodb.com/

新增 操作步骤

  1. 在mongodb0->cluster0->test库->新增表fit
  2. Github
  3. ruiLearningCode/source/js/tasks.js修改
  4. 在需要用的地方添加
    健身列表 -->
    1
    2
    3
    4
    5
    6
    7
    8
    <div id="task-container-fit" class="task-container">
    <h3 style="margin-bottom:12px;">我的健身任务清单</h3>
    <div class="add-task-box">
    <input id="new-task-title-fit" placeholder="输入新任务标题...">
    <button onclick="addTask('fit')">+</button>
    </div>
    <div id="task-list-fit"></div>
    </div>

Tips

1
2
3
4
5
6
如果报了如下错误:
Twikoo + Vercel 部署时出现 1000 bad auth : Authentication failed
{
"code":1000,
"message":"bad auth : Authentication failed."
}

Vercel官网:https://vercel.com/ 进入【Settings】->【Environment Variables】,添加环境变量【MONGODB_URI】时,目标字符串中的<password>是否替换成了 第 3 步中的【数据库密码】。 修改后,重新部署,
结果 显示

1
2
3
4
5
{
"code": 100,
"message": "Twikoo 云函数运行正常,请参考 https://twikoo.js.org/frontend.html 完成前端的配置",
"version": "1.6.44"
}