# server-api **Repository Path**: VitMusic/server-api ## Basic Information - **Project Name**: server-api - **Description**: No description available - **Primary Language**: TypeScript - **License**: Not specified - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2020-02-17 - **Last Updated**: 2020-12-19 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # server-nestjs “音域”网站后端服务,基于[Nest.js](https://docs.nestjs.cn/7/introduction)开发。 ## 安装 首先在系统中安装下列软件依赖: - ==[Node.js](https://nodejs.org/zh-cn/)== >= 13 - ==[FFmpeg](https://www.ffmpeg.org/)== required by [fluent-ffmpeg](https://github.com/fluent-ffmpeg/node-fluent-ffmpeg). - ==[libvips](https://libvips.github.io/libvips/install.html)== build with [Poppler](https://poppler.freedesktop.org/) for pdf, etc. 然后安装项目依赖: ```base # for npm $ npm install # for yarn $ yarn ``` ## 配置 修改项目根目录下环境变量文件 Rename `example.development.env` to `development.env` for development. Rename `example.production.env` to `production.env` for production. ``` ### API ### # 端口号 PORT=3000 # API是否启用认证 ## 目前,该设置项仅影响用户鉴权(即是否启用RolesGuard)。接口对JWT的需要不受影响。 AUTH_ENABLED=false # JWT有效期 AUTH_TOKEN_EXPIRES_IN=3days # JWT加密密钥 AUTH_SECRET=your_secret ### PostgreSQL 数据库相关配置 ### PG_HOST=127.0.0.1 PG_PORT=5432 PG_USERNAME=postgres PG_PASSWORD=postgres PG_DATABASE=vitmusic PG_SCHEMA=public ``` ## 启动 ```bash # development $ npm run start # watch mode $ npm run start:dev # production mode $ npm run start:prod # debug mode $ npm run start:debug ``` ## 测试 没有写测试代码,因此这部分可忽略。 ```bash # unit tests $ npm run test # e2e tests $ npm run test:e2e # test coverage $ npm run test:cov ``` ## 接口说明 本项目提供了Swagger支持,启动后访问`http://127.0.0.1:3000/api/`即可查看由Swagger生成的API文档。(并不完善,仅供参考)