Skip to content
Blog example made with nestJS
Branch: master
Clone or download
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
src Attempted to add authentication guard Oct 31, 2018
test Added app close to stop travis hanging Oct 9, 2018
.env.dist Removed root user creation from env file to prevent errors with travi… Oct 9, 2018
.gitignore Added coverage to gitignore Oct 3, 2018
.nvmrc Added nvmrc file for node 10 Oct 31, 2018
.prettierrc Started developing new version of blog example Sep 30, 2018
.travis.yml Removed v9 from travis test Oct 12, 2018
LICENSE Created License Oct 3, 2018
README.md Updated readme with packages Oct 12, 2018
docker-compose.yml
nodemon.json Started developing new version of blog example Sep 30, 2018
package.json Added collectCoverFrom key to jest to remove dirs Oct 15, 2018
testdb.sh Changed to logs Oct 9, 2018
tsconfig.json Started developing new version of blog example Sep 30, 2018
tslint.json Started developing new version of blog example Sep 30, 2018
webpack.config.js Started developing new version of blog example Sep 30, 2018
yarn.lock Added blog directory with tests Oct 14, 2018

README.md

NestJS Blog

Coverage Status

This is an example of how to use nestjs with jwt and typeorm to build a basic blog API.

Use

  • Start the mysql container using docker
$ docker-compose up -d 
  • Start the nestjs process using to following
$ yarn start

Production

If you're going to use this example in production (or your own verison of it) it's recommended to run using the 'complied' JS version from dist. You can do this by using the following command

$ yarn start:prod

This command will also clean and build your dist folder

Development

For development, the best command to use is

$ yarn start:dev

This will start nodemon to reload our script when there's been any changes in the src directory

Testing

Unit testing

Unit tests can be ran by simply using the test script

$ yarn test

This will run jest on all .spec.ts files.

End to End testing (E2E)

End to end tests can be run by using the following command

$ yarn test:e2e

this will run jest on all .e2e-spec.ts files.

Coverage

Use jest to show you a coverage of your tests

$ yarn test:cov

Build your own NestJS application

Want to get started on your own NestJS application? Simply install the nest-cli npm i -g @nestjs/cli and use the command nest new my-application to create a new directory called my-application with nestjs ready to go!

Packages

I used a variety of packages to develop this example api. Here's a list of them and where I got them from

You can’t perform that action at this time.