GithubHelp home page GithubHelp logo

mercurialjd / typescript-starter Goto Github PK

View Code? Open in Web Editor NEW

This project forked from nestjs/typescript-starter

0.0 0.0 0.0 18.25 MB

Nest framework TypeScript starter :coffee:

Home Page: https://nestjs.com

JavaScript 2.84% TypeScript 97.16%

typescript-starter's Introduction

Nest Logo

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

NPM Version Package License NPM Downloads CircleCI Coverage Discord Backers on Open Collective Sponsors on Open Collective Donate us Support us Follow us on Twitter

Description

This is a Nest framework Feature Enhancement Assignment. This assignment implements a new feature to manage a collection of tasks, each task has the following properties:

  • id: unique identifier, auto-generated
  • title: string, required
  • description: string, optional
  • status: enum, required: ['TODO', 'IN_PROGRESS', 'COMPLETED']
  • createdAt: date, auto-generated
  • updatedAt: date, auto-generated

This assignment implements the following operations:

  • Create a new task (POST)
  • Retrieve a task by its id (GET)
  • Delete a task by its id (DELETE)

Files

The folder src/tasks contains implementation and unit tests for the new module TasksModule, which contains the following files:

  • The file tasks.entity.ts defines Task and TaskStatus.
  • The file tasks.controller.ts validates the parameters and implements routing for the 3 RESTful APIs (POST, GET, DELETE).
  • The file tasks.service.ts implements logics for task storage and query.
  • The file tasks.controller.spec.ts contains unit tests for the controller, implemented with Jest.
  • The file tasks.service.spec.ts contains unit tests for the provider, implemented with Jest.

The E2E tests are placed under the test folder, which connects to a PostgreSQL database and runs E2E tests automatically.

Prerequisites

  1. Install the PostgreSQL, create a database called "Tasks".
  2. Install Node.js and npm.
  3. Install the Nest.js CLI.
  4. Tools to test the APIs, e.g. Postman.

Assignment 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

# unit tests coverage
$ npm run test:cov

# e2e tests
$ npm run test:e2e

# e2e tests coverage
$ npm run test:e2e:cov

Note:

  1. When checking the coverage for unit tests, it would complain about *.module.ts, but was suggested to ignore them and test those files in the E2E tests.
  2. When checking the coverage for E2E tests, line 5 of tasks.entity.ts was marked as uncovered. That was an imported decorator, seems unnecessary to write tests specifically for it.

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.

typescript-starter's People

Contributors

allenfang avatar alsoicode avatar beeman avatar blazeu avatar brunnerlivio avatar dependabot[bot] avatar elylucas avatar fanybook avatar fishuke avatar h4ad avatar hiagodotme avatar jajaperson avatar kamilmysliwiec avatar konradlinkowski avatar lambdacasserole avatar maximzinovik avatar mchelen avatar mercurialjd avatar micalevisk avatar nosfistis avatar progral avatar renovate-bot avatar rpihlak avatar rubencodeforges avatar rubiin avatar sacro avatar schinvendy avatar tony133 avatar whitekiwi avatar yurykozhenov avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.