Skip to content

dede999/nest-ts-example

Repository files navigation

Nest Logo

A progressive Node.js framework for building efficient and scalable server-side applications, heavily inspired by Angular.

NPM Version Package License NPM Downloads Travis Linux Coverage Gitter Backers on Open Collective Sponsors on Open Collective

References

Book #1 -- Build a Recipe App with Nest.js and MongoDB

Description

Nest framework TypeScript starter repository.

Installation

$ npm install

Running the app

# development
$ npm run start

# watch mode
$ npm run start:dev

# production mode
$ npm run start:prod

Test

# unit tests
$ npm run test

# e2e tests
$ npm run test:e2e

# test coverage
$ npm run test:cov

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.

Running a little experiment about compression

According to Compression Recipe Page, it can greatly decrease the size of the response body, thereby increasing the speed of a web app. In order to check this out, I'll compare the time taken for each request. I'll run the requests on Postman

POST /recipe/new

  • Without Compressing Post 57 ms
  • With Compressing Post 18 ms

GET /recipe/all

  • Without Compressing Get All 35 ms
  • With Compressing Get All 19 ms

GET /recipes/:id

  • Without Compressing Get One 14 ms
  • With Compressing Get One 13 ms

PUT /recipes/:id

  • Without Compressing Put 42 ms
  • With Compressing Put 37 ms

DELETE /recipes/:id

  • Without Compressing Delete 11 ms
  • With Compressing Delete 13 ms

Conclusion

As promised, it became faster indeed. And though I believed it wouldn't be as evident as it was if the dataset was larger, results showed a noticable difference. In case you want to run these test on your machine, go to src/main.ts and coment an specific line

async function bootstrap() {
  const app = await NestFactory.create(AppModule);
  // app.use(compression()) comment this line

About

Learning from Nest JS Documentation

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published