/toybox-api

api via nestjs with swagger

Primary LanguageTypeScript

Toybox API / Fullstack Typescript Demo

Passport Logo Open API Initiative (OAI) Logo Nest Logo MongoDB Logo

Description

Toybox API uses the Nest framework TypeScript starter repository. See toybox-web for web client using vuetify.

Prerequisites

Installation

$ npm install

Deploy API client for local development

  1. Run commands:

      # Review client openapitools configuration
      > toybox-api\openapi-config.json
      > toybox-api\package.json > scripts/gen-backend
    
      # Generate client
      > cd toybox-api
      > npm run gen-backend
    
      # Build client
      > cd ..\toybox-backend-ts-axios
      > npm install
      > npm run build
    
      # Install
      > cd ..\toybox-web
      > npm install ..\toybox-backend-ts-axios --save
    
  2. Review package.json for client reference

      "toybox-backend": "file:../toybox-backend-ts-axios"
    

Running the app

# start data services (mongodb)
$ "C:\Program Files\MongoDB\Server\4.4\bin\mongod.exe" --dbpath "C:\data\toybox"

# development
$ npm run start

# watch mode
$ npm run start:dev

# production mode
$ npm run start:prod

API Client Generation

Delete folder 'api/cient' and all contents Generate the api/client

npm run gencli

Add file .eslintignore, and add:

/*.*

Test

# unit tests
$ npm run test

# e2e tests
$ npm run test:e2e

# test coverage
$ npm run test:cov

Support

None

Contact

License

None

Support

  1. Issue during build of API results in no changes: [SO](nestjs SwaggerDocumentOptions github)
    npm run prebuild