微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

如何在 Vercel 中使用 json-server mocha 上传前端项目?

如何解决如何在 Vercel 中使用 json-server mocha 上传前端项目?

我有一个Angular 制作的项目和一个json-server 制作的简单模拟,我想知道除了运行前端,运行 json-server 之外,我如何制作 vercel,是吗?可能吗?

该项目已在 vercel 部署,但我无法让它运行 yarn start_backend 命令,因此后端可以使用模拟。

package.json

"scripts": {
    "start_backend": "json-server --watch --port 4300 db.json","ng": "ng","start": "ng serve","build": "ng build","test": "ng test","lint": "ng lint","e2e": "ng e2e"
}

json-sever.json

{
    "port": 4300,"delay": 200
}

db.json

{
  "users": [
    {
      "id": "0f1f30df-aa71-4c49-bb5f-aa71c689a432","full_name": "THIAGO DE BONIS","avatar": "assets/images/users/thiago.jpg","isMain": true,"isClicked": false
    },{
      "id": "cd7a7081-8d00-4156-98fb-ae0410532b37","full_name": "BILL GATES","avatar": "assets/images/users/bill.jpg","isMain": false,{
      "id": "aba7beca-0ffa-4057-8e45-fb65ea11d4a0","full_name": "MARGARET HAMILTON","avatar": "assets/images/users/margaret.jpg",{
      "id": "75d5a93f-25a3-44b8-a00c-9ec540e7269d","full_name": "STEVE JOBS","avatar": "assets/images/users/steve.jpg",{
      "id": "d4918415-f2db-438a-9ecd-61cd504d626c","full_name": "nikola TESLA","avatar": "assets/images/users/tesla.jpg",{
      "id": "d564173f-bd44-41c5-95a9-4c0f3088271b","full_name": "LINUS TORVALDS","avatar": "assets/images/users/linus.jpg",{
      "id": "85afbbab-d675-49b0-bbfe-c7903018c65b","full_name": "EDSGER DIJKSTRA","avatar": "assets/images/users/dijkstra.jpg","isClicked": true
    },{
      "id": "758474b4-0ac4-46be-81a4-bf7f14a6b740","full_name": "WARREN BUFFETT","avatar": "assets/images/users/warren.jpg",{
      "id": "be1044ec-4e0b-4bab-86ac-87ca7dce7bc2","full_name": "JACK MA","avatar": "assets/images/users/jack.jpg",{
      "id": "cbfe2ee3-6a4d-4c00-9206-f59694e31c30","full_name": "MARK ZUCKERBERG","avatar": "assets/images/users/mark.jpg","isClicked": false
    }
  ],"chat": [
    {
      "id": "cd7a7081-8d00-4156-98fb-ae0410532b37","messages": [
        {
          "id": "9f5da669-c6a4-4be2-8ad3-8f29058efbea","text": "Try once,twice,three times and if possible try the fourth,fifth and as many times as necessary.Just don't give up in the first few attempts,persistence is a friend of conquest. If you want to get to where the majority doesn't,do what the majority don't.","time": "2020-06-16T18:06:00.000Z","isRead": false
        }
      ]
    },"messages": [
        {
          "id": "8e19f8fe-d5b6-424a-a8bf-6b9538f5de49","text": "?? I'm the programmer who put the rocket on the moon,how about you? What have you done for humanity?","time": "2020-06-16T18:16:00.000Z","messages": [
        {
          "id": "de89e189-138f-4e3a-bb20-6124feceb576","text": "To be successful,it is necessary to truly love what you do. Otherwise,taking into account only the rational side,you simply give up. This is what happens to most people.","time": "2020-06-16T18:46:00.000Z","isRead": true
        }
      ]
    },"messages": [
        {
          "id": "0388a61b-d361-47b3-aaa5-59363f51785d","text": "Human development depends fundamentally on invention. It is the most important product of your creative brain. Its ultimate goal is the complete mastery of the mind over the material world and the use of the forces of nature in favor of human needs.","time": "2020-06-16T18:18:00.000Z","messages": [
        {
          "id": "ce980f6e-5b9c-4edb-b8ea-cd3d45f83fb8","text": "Talking is easy,show me the code.","time": "2020-06-16T18:03:00.000Z","messages": [
        {
          "id": "08377c54-4843-48c1-9b48-28ab8d586a8d","text": "Program testing can be a very effective way to demonstrate the presence of errors,but it is hopelessly insufficient to show its absence.","time": "2020-06-16T19:06:00.000Z","messages": [
        {
          "id": "57bf6d07-7490-4c8f-bf30-57d954038e8d","text": "Most people are interested in actions when everyone is interested. The time to be interested is when no one else is interested. You don't make money buying what is popular.","time": "2020-06-16T18:05:00.000Z","messages": [
        {
          "id": "a1c563c3-1965-463f-bce5-fc01baf16c5a","text": "The world won't remember what you say,but it certainly won't forget what you did.","time": "2020-06-16T18:04:00.000Z","messages": [
        {
          "id": "d9c2b42e-c6da-4de7-9aeb-0686b5685ed1","text": "In a world where changes are taking place quickly,the only strategy that will guarantee failure is to not take risks.","time": "2020-06-16T18:01:00.000Z","isRead": false
        }
      ]
    }
  ]
}

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。

相关推荐


Selenium Web驱动程序和Java。元素在(x,y)点处不可单击。其他元素将获得点击?
Python-如何使用点“。” 访问字典成员?
Java 字符串是不可变的。到底是什么意思?
Java中的“ final”关键字如何工作?(我仍然可以修改对象。)
“loop:”在Java代码中。这是什么,为什么要编译?
java.lang.ClassNotFoundException:sun.jdbc.odbc.JdbcOdbcDriver发生异常。为什么?
这是用Java进行XML解析的最佳库。
Java的PriorityQueue的内置迭代器不会以任何特定顺序遍历数据结构。为什么?
如何在Java中聆听按键时移动图像。
Java“Program to an interface”。这是什么意思?