Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/grimmer0125/nestjs-example
More integration example: https://github.com/grimmer0125/full-stack-example
https://github.com/grimmer0125/nestjs-example
Last synced: 1 day ago
JSON representation
More integration example: https://github.com/grimmer0125/full-stack-example
- Host: GitHub
- URL: https://github.com/grimmer0125/nestjs-example
- Owner: grimmer0125
- Created: 2020-07-14T06:32:24.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2023-01-24T03:18:57.000Z (almost 2 years ago)
- Last Synced: 2024-04-28T04:58:18.353Z (6 months ago)
- Language: TypeScript
- Homepage:
- Size: 3.16 MB
- Stars: 1
- Watchers: 3
- Forks: 0
- Open Issues: 16
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
[travis-image]: https://api.travis-ci.org/nestjs/nest.svg?branch=master
[travis-url]: https://travis-ci.org/nestjs/nest
[linux-image]: https://img.shields.io/travis/nestjs/nest/master.svg?label=linux
[linux-url]: https://travis-ci.org/nestjs/nest
A progressive Node.js framework for building efficient and scalable server-side applications, heavily inspired by Angular.
## Description
A [Nest](https://github.com/nestjs/nest) TypeScript example repository. Test restful with JWT authorization and graphql (with authorization and subscription) on http://localhost:3001
## Installation
```bash
$ yarn install
```## Running the app
```bash
# development
$ yarn run start# watch mode
$ yarn start:dev# production mode
$ yarn start:prod
```Or use VSCode+F5 to launch debugging mode.
## Try restful and graphql
### In terminal
Login to get token:
```
$ curl -X POST http://localhost:3001/auth/login -d '{"username": "john", "password": "changeme"}' -H "Content-Type: application/json"
```Try using auth token to get profile:
```
$ curl http://localhost:3001/profile -H "Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2Vybm..."
```### In playground
Open `http://localhost:3001/graphql`, test following graphql commands.
```
query whoami {
whoAmI {
id
firstName
lastName
}
}subscription commentAdded{
commentAdded {
id
author
}
}mutation addComment{
addComment(comment:"test", postId:7) {
id
author
}
}# paste the token from terminal
header:
{
"authorization": "Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VybmFtZSI6ImpvaG4iLCJzdWIiOjEsImlhdCI6MTU5NDgwNTc3MCwiZXhwIjoxNTk5OTg5NzcwfQ.yzjP-Y36P3__ED_RpfwkVIRdypGAGoXz9iDdta-KFB4"
}
```## Unit Tests and & End To End Tests
```bash
# unit tests
$ npm run test# e2e tests
$ npm run test:e2e# test coverage
$ npm run test:cov
```