max 45b4b185e5 接口初始化 6 өдөр өмнө
..
src 45b4b185e5 接口初始化 6 өдөр өмнө
test 88282c57e5 init 2 долоо хоног өмнө
uploads 45b4b185e5 接口初始化 6 өдөр өмнө
.gitignore 88282c57e5 init 2 долоо хоног өмнө
.prettierrc 88282c57e5 init 2 долоо хоног өмнө
ESLINT_FIXES.md 45b4b185e5 接口初始化 6 өдөр өмнө
FILE_UPLOAD_README.md 45b4b185e5 接口初始化 6 өдөр өмнө
README.md 45b4b185e5 接口初始化 6 өдөр өмнө
eslint.config.mjs 88282c57e5 init 2 долоо хоног өмнө
nest-cli.json 88282c57e5 init 2 долоо хоног өмнө
package.json 45b4b185e5 接口初始化 6 өдөр өмнө
pnpm-lock.yaml 45b4b185e5 接口初始化 6 өдөр өмнө
test-file-upload.md 45b4b185e5 接口初始化 6 өдөр өмнө
tsconfig.build.json 88282c57e5 init 2 долоо хоног өмнө
tsconfig.json 88282c57e5 init 2 долоо хоног өмнө

README.md

LMS-NodeJs

一个基于NestJS框架的图书管理系统后端API。

环境配置

在项目根目录创建 .env 文件,添加以下配置:

# 服务器配置
SERVER_URL=http://localhost:3000
FILE_PATH=./uploads
PORT=3000

# 数据库配置
DB_HOST=localhost
DB_PORT=3306
DB_USERNAME=root
DB_PASSWORD=123456
DB_DATABASE=books

# 其他配置
NODE_ENV=development

环境变量说明

  • SERVER_URL: 服务器地址,用于生成文件访问URL(默认:http://localhost:3000)
  • FILE_PATH: 文件存储路径(默认:./uploads)
  • PORT: 服务器端口(默认:3000)
  • DB_HOST: 数据库主机地址
  • DB_PORT: 数据库端口
  • DB_USERNAME: 数据库用户名
  • DB_PASSWORD: 数据库密码
  • DB_DATABASE: 数据库名称

功能特性

  • 文件管理: 支持文件上传、下载和去重
  • 图书管理: 完整的图书CRUD操作
  • 作者管理: 作者信息管理
  • 标签管理: 标签分类管理
  • 章节管理: 图书章节管理
  • 热门管理: 热门内容管理
  • 辅助功能: 辅助工具管理
  • 行管理: 文本行管理

文件上传功能

上传文件

curl -X POST http://localhost:3000/file/upload -F "file=@test.jpg"

访问文件

curl -X GET http://localhost:3000/file/download/[fileId]

或在浏览器中访问:http://localhost:3000/file/download/[fileId]


Nest Logo

A progressive Node.js framework for building efficient and scalable server-side applications.

<p align="center">

NPM Version Package License NPM Downloads CircleCI Discord Backers on Open Collective Sponsors on Open Collective Donate us

<a href="https://opencollective.com/nest#sponsor"  target="_blank"><img src="https://img.shields.io/badge/Support%20us-Open%20Collective-41B883.svg" alt="Support us"></a>

Follow us on Twitter

Description

Nest framework TypeScript starter repository.

Project setup

$ pnpm install

Compile and run the project

# development
$ pnpm run start

# watch mode
$ pnpm run start:dev

# production mode
$ pnpm run start:prod

Run tests

# unit tests
$ pnpm run test

# e2e tests
$ pnpm run test:e2e

# test coverage
$ pnpm run test:cov

Deployment

When you're ready to deploy your NestJS application to production, there are some key steps you can take to ensure it runs as efficiently as possible. Check out the deployment documentation for more information.

If you are looking for a cloud-based platform to deploy your NestJS application, check out Mau, our official platform for deploying NestJS applications on AWS. Mau makes deployment straightforward and fast, requiring just a few simple steps:

$ pnpm install -g @nestjs/mau
$ mau deploy

With Mau, you can deploy your application in just a few clicks, allowing you to focus on building features rather than managing infrastructure.

Resources

Check out a few resources that may come in handy when working with NestJS:

  • Visit the NestJS Documentation to learn more about the framework.
  • For questions and support, please visit our Discord channel.
  • To dive deeper and get more hands-on experience, check out our official video courses.
  • Deploy your application to AWS with the help of NestJS Mau in just a few clicks.
  • Visualize your application graph and interact with the NestJS application in real-time using NestJS Devtools.
  • Need help with your project (part-time to full-time)? Check out our official enterprise support.
  • To stay in the loop and get updates, follow us on X and LinkedIn.
  • Looking for a job, or have a job to offer? Check out our official Jobs board.

Support

Nest is an MIT-licensed open source project. It can grow thanks to the sponsors and support by the amazing backers. If you'd like to join them, please read more here.

Stay in touch

License

Nest is MIT licensed.

https://www.cnblogs.com/bluecobra/archive/2012/01/11/2318922.html