Skip to content

v1.0.1

Compare
Choose a tag to compare
@github-actions github-actions released this 06 Apr 00:55
80db925

Release notes

Yeoman generator that creates a base structure to create APIs in koa2 with sequelize and others tools.

Feature added in version 1.0.1:

  • Removed @babel/plugin-transform-runtime from api/babel.config.json
  • Adds in documentation default value for nodeVersion in docker generator (node version 16)

Features added in version 1.0.0:

  • generator-koa2-api-generator only include configurations for development environment.
  • Adds configurations for commitlint, prettier, swagger, husky, openapi, sequelize, jsonwebtoken and other tools.
  • Installs database drivers ans create Docker Compose configuration for postgresql, mysql and mariadb.
  • Adds docker support.
  • Adds docker compose support.
  • Include dotenv and openapi-comment-parser in dev dependencies.
  • Include ajv, ajv-errors and ajv-formats to use JSON Schemas.
  • Include globs and jsonwebtoken in dependencies.
  • If you do not want to use openapi.
    • Delete the api/src/schemas/openapi folder.
    • Delete the api/src/config/openapi.js file.
    • Delete the api/src/routes/swagger folder.
    • In the api/src/routes/index.js file, delete:
      if (environment !== 'production') {
        router.use('/docs', swaggerRouter.routes())
      }
    • In terminal use:
        cd api
        npm uninstall openapi-comment-parser
    • delete api-specification.yml
    • Remove the openapi comment in the files in api/src/routes, for example:
        /**
          * GET /api/v1/users/{userEmail}
          *
          * @tag API endpoints
          * @security BearerAuth
          * @summary Get an user by email
          * @pathParam {string} userEmail
          * @response 200 - Ok
          * @responseContent {User} 200.application/json
          * @response 401 - Unauthorized
          * @responseComponent {Unauthorized} 401
          * @response 404 - Not found
          * @responseComponent {NotFound} 404
          * @response 500 - Internal Server Error
          * @responseComponent {InternalServerError} 500
        */
        router.get('/:userEmail', async (ctx) => {
      This comment begin with GET, POST, PUT or others HTTP Verb.
  • If you do not want to use JSON Schemas.
    • Delete the api/src/schemas/json folder.
    • In terminal use:
        cd api
        npm uninstall ajv ajv-errors ajv-formats globs
    • Delete in files api/src/routes/user/registerRouter.js, api/src/routes/user/router.js and api/src/routes/authentication/tokenRouter.js
      import { simpleJsonSchemaValidation } from '../../schemas/json/index.js'