Skip to content

Run Server in Local Computer #2

Description

@Chen-Gary

1. Environment

  • Node.js

    Server will run in port 3000 (i.e. localhost:3000)

  • MongoDB

    完全使用默认配置

    • 保证 MongoDB daemon 运行在 port 27017
    • 不设置数据库用户名、密码
    • 运行 server 后,会自动创建名为 note_squared 的数据库,可使用MongoDB Compass查看

2. Run Server

cd /note-squared/server

# 安装依赖
npm install

# 使用 nodemon 运行 server(如果修改 server 代码,会自动 restart)
npm run dev

# OR 使用以下命令(如果修改 server 代码,不会自动 restart)
npm run start

3. 其他注意事项

  • 如何获得一个带有 admin 权限的账号?

    现在无法直接注册带有 admin 权限的账号了,需要手动修改数据库: users => role,手动改为admin / normal

image

  • 注册时,需要验证邮箱吗?

    目前调用获取邮箱验证码的API后,验证码会直接返回给前端,所以即使填了假邮箱也没事。

    如果需要测试邮件是否真的能发送,找到server/app/router/user/register_emailVerificationCode.js文件中以下代码:

    // send verification email
    // (temporarily removed)
    //await nodemailer.sendVerificationCode(_email, _email, _verificationCode)

    删掉最后一行的注释即可。

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    documentationImprovements or additions to documentation

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions