项目作者: DongCarzy

项目描述 :
nestjs 学习 demo
高级语言: TypeScript
项目地址: git://github.com/DongCarzy/nestjs-demo.git
创建时间: 2018-07-26T08:09:45Z
项目社区:https://github.com/DongCarzy/nestjs-demo

开源协议:

下载


nestjs-demo

Description

初步demo

download code

  1. $ git clone https://github.com/DongCarzy/nestjs-demo.git

or

  1. https://github.com/DongCarzy/nestjs-demo/archive/master.zip

Installation

  1. $ npm install

Running the app

  1. # development
  2. $ npm run start
  3. # watch mode
  4. $ npm run start:dev
  5. # production mode
  6. npm run start:prod

Test

  1. # unit tests
  2. $ npm run test
  3. # e2e tests
  4. $ npm run test:e2e
  5. # test coverage
  6. $ npm run test:cov

测试API

可能无效

  1. https://documenter.getpostman.com/view/1366049/RWMJr7Dm#intro

四组API

  • 查询所有
    1. curl --request GET --url http://localhost:3000/user
  • 新增
    1. curl --request POST \
    2. --url http://localhost:3000/user \
    3. --header 'Content-Type: application/json' \
    4. --data '{
    5. "id": 1,
    6. "no": "1",
    7. "name": "111"
    8. }'
  • 修改
    1. curl --request PATCH \
    2. --url http://localhost:3000/user/1 \
    3. --header 'Content-Type: application/json' \
    4. --data '{
    5. "no": "11_no",
    6. "name": "11_name"
    7. }'
  • 查询单个
    1. curl --request GET \
    2. --url http://localhost:3000/user/1
  • 删除
    1. curl --request DELETE \
    2. --url http://localhost:3000/user/1