--- lang: ja-jp breaks: true --- # TypeScript NestJS NestExpressApplication で Hello World 2021-05-17 ```shell= $ sudo npm install -g @nestjs/cli ``` ## プロジェクトの作成 ```shell= nest new [project-name] ``` ## 実行 ```shell= npm start ``` または、 ```shell= yarn start ``` ## 確認 http://localhost:3000/ ![](https://i.imgur.com/bl2jdi8.png) ## テストの実行 ```shell= npm test ``` または、 ```shell= yarn test ``` ## テストに失敗した場合 ```shell= $ npm test > nestjs-001@0.0.1 test > jest FAIL src/app.controller.spec.ts AppController root ✕ should return "Hello World!" (13 ms) ● AppController › root › should return "Hello World!" expect(received).toBe(expected) // Object.is equality Expected: "こんにちは世界??" Received: "こんにちは世界!!" 17 | describe('root', () => { 18 | it('should return "Hello World!"', () => { > 19 | expect(appController.getHello()).toBe('こんにちは世界??'); | ^ 20 | }); 21 | }); 22 | }); at Object.<anonymous> (app.controller.spec.ts:19:40) Test Suites: 1 failed, 1 total Tests: 1 failed, 1 total Snapshots: 0 total Time: 2.454 s Ran all test suites. ``` ###### tags: `TypeScript` `NestJS` `NestExpressApplication` `Hello World`