# NestJs-Study **Repository Path**: jhao-study/NestJs-Study ## Basic Information - **Project Name**: NestJs-Study - **Description**: nestjs学习 - **Primary Language**: Unknown - **License**: Not specified - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2020-07-13 - **Last Updated**: 2020-12-19 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README ### nestjs创建新项目 ``` npm i -g @nestjs/cli nest new webserver ``` ### 静态网站 ``` const app = await NestFactory.create(AppModule); // app.useStaticAssets('public'); let nowPath:string =join(__dirname, '../public/', 'static'); Logger.log("nowPath==="+nowPath) app.useStaticAssets(nowPath, { prefix: '/static/', // 虚拟名称 http://localhost:3010/static/...png }); await app.listen(3000); ``` ### nestjs中安装 socketIo对应模块 ``` npm i --save @nestjs/websockets @nestjs/platform-socket.io npm i --save-dev @types/socket.io ``` ## 通过命令行工具生成gateway并配置socket ``` nest g gateway events ```