当前位置:网站首页>Nestjs入门和环境搭建
Nestjs入门和环境搭建
2022-06-30 05:01:00 【Johnny丶me】
Nest.js 官网
- 官方文档:https://docs.nestjs.com/
- 中文文档:https://docs.nestjs.cn/
- Github:https://github.com/nestjs/nest
Nest.js 是什么
- Nest 是一个渐进的 Node.js 框架,基于TypeScript和JavaScript建高效可伸缩的企业级服务器端应用程序
- 内置TypeScript并结合了OOP,FP和FRP相关理念,设计思想源于Angular和Java
- Nest是Nodejs的的Spring框架,底层HTTP平台默认是基于Express实现的
- 有两个支持开箱即用的HTTP平台:express 和 fastify
- 核心设计思想:提供一个层与层之间耦合度极小抽象化极高的一个设计体系
Nest.js 的特性
- 默认基于Express,也可以基于其他Web HTTP框架
- 默认基于Typescript, 更优秀的面向对象编程体验
- 模块化设计,支持依赖注入
- 支持编写自动化测试程序
- …
Nest.js 快速入门、搭建环境、创建项目
1 ) 环境准备
操作系统:支持 macOS,Linux,Windows
运行环境:Nodejs 建议选择 LTS 版本,建议使用最新版本
2 ) 安装 Nest 脚手架以及使用 CLI 创建项目
我们推荐直接使用脚手架,只需几条简单指令,即可快速生成项目:
- $
cnpm i -g @nestjs/clicli的安装 - $
nest new nest-project基于cli命令生成项目
启动项目:
- $
cnpm run start或 $cnpm run start:dev - $
open http://localhost:3000/
Nest.js 目录结构
nest-project
├── .eslintrc.js eslint配置文件
├── .gitignore git忽略文件
├── .prettierrc prettier 配置文件
├── nest-cli.json cli配置文件
├── package.json 配置文件, 不仅是包依赖配置
├── README.md 描述文档
├── tsconfig.build.json ts配置文件
├── tsconfig.json ts配置文件
├── yarn.lock 版本锁文件
├── dist 构建后的目录
├── test 自动化测试目录
├── src 源码目录
│ ├── app.controller.spec.ts
│ ├── app.controller.ts
│ ├── app.module.ts
│ ├── app.service.ts
│ ├── main.ts
- 可以看到Nest.js的模板目录极简
边栏推荐
- 力扣59. 螺旋矩阵 II
- LxC and LXD container summary
- Unity multiple UI page turning left and right
- [recruitment] UE4 Development Engineer
- Unity3d Google Earth
- Spring Festival Tourism Strategy: welcome the new year in Bangkok, Thailand
- 力扣704. 二分查找
- 2021-07-29 compilation of Cura in ubantu18.04
- Four methods of unity ugui button binding events
- 003-JS-DOM-Attr-innerText
猜你喜欢

Pourquoi l'ordinateur n'a - t - il pas de réseau après l'ouverture du Hotspot win10?

Unity3d realizes Google Digital Earth

What is multimodal interaction?

Harbor API 2.0 query

Sailing experience not to be missed in New York Tourism: take you to enjoy the magnificent city scenery from different perspectives

力扣349. 两个数组的交集

Connect to the database and run node JS running database shows that the database is missing

Some books you should not miss when you are new to the workplace
![[UAV] gyroscope data analysis, taking Victor intelligent jy901b as an example](/img/d7/7bf43437edb87b69cdc5ae858f44e1.jpg)
[UAV] gyroscope data analysis, taking Victor intelligent jy901b as an example

Yolov5 torch installation
随机推荐
UnityEngine. JsonUtility. The pit of fromjason()
Steamvr causes abnormal scene camera
harbor api 2.0查询
Yolov5 torch installation
【Paper】2017_ Research on coordinated control method of underwater vehicle formation marine survey
C # Foundation
Solution to 293 problems in the week of Li Kou
Connect to the database and run node JS running database shows that the database is missing
为什么win10开热点后电脑没有网络?
Unity3d realizes Google Digital Earth
Unity profiler performance analysis
【VCS+Verdi联合仿真】~ 以计数器为例
UE4 method of embedding web pages
[UGV] schematic diagram of UGV version 32
redis集群概念
Webots learning notes
Unrealeengine4 - about uobject's giant pit that is automatically GC garbage collected
Force buckle 209 Minimum length subarray
brew安装nvm报nvm command not found解决方案
National Museum of Singapore - give you spiritual and physical satisfaction