Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

如何在本地进行调试代码? #128

Closed
Surile opened this issue Nov 13, 2020 · 4 comments
Closed

如何在本地进行调试代码? #128

Surile opened this issue Nov 13, 2020 · 4 comments

Comments

@Surile
Copy link

Surile commented Nov 13, 2020

目录结构

shutter_server
├─.env.development
├─.env.production
├─.env.staging
├─.eslintignore
├─.eslintrc
├─.gitignore
├─.prettierrc
├─README.md
├─cloudbaserc.json
├─package.json
├─yarn-error.log
├─src
|  ├─main.js  // 入口文件
|  ├─utils
|  |   └tcb.js
|  ├─routes
|  |   ├─index.js
|  |   └users.js
|  ├─models
|  |   .gitkeep
|  ├─middleware
|  |     ├─.gitkeep
|  |     └error.js
|  ├─controllers
|  |      ├─.gitkeep
|  |      └index.js

cloudbaserc配置

{
  "envId": "{{env.ENV_ID}}",
  "version": "2.0",
  "$schema": "https://framework-1258016615.tcloudbaseapp.com/schema/latest.json",
  "framework":{
    "name": "shutter_server",
    "plugins":{
      "node":{
        "use": "@cloudbase/framework-plugin-node",
        "inputs": {
          "entry": "./src/main.js",
          "name":"shutter_server",
          "path":"/shutter_server"
        }
      }
    },
    "db":{
      "use":"@cloudbase/framework-plugin-database",
      "inputs":{
        "collections":[
          {
            "collectionName": "shutter_posts",
            "description": "系统用户数据,存储用户发布的内容",
            "aclTag": "ADMINONLY"
          },
          {
            "collectionName": "shutter_users",
            "description": "系统用户数据,存储用户信息,包括管理员和运营者的账号信息,包括角色信息,用户,加密存储的密码等",
            "aclTag": "ADMINONLY"
          },
          {
            "collectionName": "shutter_albums",
            "description": "系统用户数据,存储用户发布的专辑",
            "aclTag": "ADMINONLY"
          }
        ]
      }
    }
  }
}

在vscode开启本地调试,提示找不到cloudbaserc配置文件,点击入口文件,找不到调式的菜单。

代码已发布到github上,位置shutter_server

@issue-label-bot
Copy link

Issue Label Bot is not confident enough to auto-label this issue. See dashboard for more details.

@binggg
Copy link
Collaborator

binggg commented Nov 13, 2020

目前暂未暴露 node 应用的直接调试命令,后续会暴露这个直接启动调试的命令

目前可以在你的入口文件中这里加入一行代码
https://github.com/Surile/shutter_server/blob/master/src/main.js#L34

app.listen(3000) // 或者其他端口也可以

然后直接 node src/main.js 即可本地启动,本地打开 127.0.0.1:3000 即可

@Surile
Copy link
Author

Surile commented Nov 13, 2020

目前暂未暴露 node 应用的直接调试命令,后续会暴露这个直接启动调试的命令

目前可以在你的入口文件中这里加入一行代码
https://github.com/Surile/shutter_server/blob/master/src/main.js#L34

app.listen(3000) // 或者其他端口也可以

然后直接 node src/main.js 即可本地启动,本地打开 127.0.0.1:3000 即可

好的。明白了

@binggg
Copy link
Collaborator

binggg commented Nov 13, 2020

好的,issue 我暂时先关闭了

@binggg binggg closed this as completed Nov 13, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants