Skip to content

Releases: KhomsiAdam/create-express-rest-ts

create-express-rest-ts v2.0.0

02 Jun 16:05
Compare
Choose a tag to compare

Changelogs:

Features:

  • When using npx for installation, you can add a flag to pick which package manager is preferred for installation and usage during development (yarn is used by default):
npx create-express-gql-ts my-app --npm

or:

npx create-express-gql-ts my-app --pnpm

*If the project is cloned, downloaded or used as a template, some operations must be done manually to ensure a smooth migration from yarn to the prefered package manager. Please refer to the docs for more informations: https://github.com/KhomsiAdam/create-express-rest-ts#usage

  • You can add arguments specific to each package manager:
npx create-express-gql-ts <app-name> --packagemanager [args]

For npm as an example. you might need to pass in the --force flag to force installation even with conflicting peer dependencies:

npx create-express-gql-ts my-app --npm --force
  • Replaced nodemon with ts-node-dev for better performance with TypeScript during developement.
  • Github workflow file for each package manager.
  • Added is.Self and is.Own permissions middlewares.

Refactoring:

  • Renamed "isAuth" middleware to "permissions".
  • Changed database error and added check for credentials.

create-express-ts-rest-api v1.1.0

04 May 19:59
Compare
Choose a tag to compare

Changelogs:

Features:

  • Added husky and commitizen.
  • Changed getOne method to getByField to be dynamic (get by id by default).
  • Register by role, defaults to User role.
  • Adding a new role to Roles constant automatically adds them to interface and model.

Refactoring:

  • Renamed some variables, removed unnecessary lines.
  • Reformatted error stack trace to be split into array for better readability.
  • Made the optional populate logic into a helper function.
  • Changed import statements to mostly destructured ones and import type for types.

create-express-ts-rest-api v1.0.2

21 Apr 03:35
Compare
Choose a tag to compare

Attempt at fixing bin for npx.

create-express-ts-rest-api v1.0.1

21 Apr 03:28
Compare
Choose a tag to compare

Set up and build a Node.js REST API using Typescript, Express, Mongoose with a maintainable and scalable structure.

The project structure is based on MVC and follows it's basic principles but is a little bit different in which instead of having the entities logic spread out into specific folders (models folder containing all models, controllers folder containing all controllers etc...).

Each entity has it's own folder containing all it's core logic in isolation from other entities. Let's take the User entity as an example:

src
└── entities
    └── user
        ├── constants.ts
        ├── controller.ts
        ├── endpoints.ts
        ├── interface.ts
        ├── model.ts
        └── validation.ts

With this structure it is easier to maintain and scale with multiple entities (you will rarely have to switch between folders in order to manage one entity).

The project comes with many built-in features, such as:

  • Authentication with JWT: providing both an access token and refresh token (sent as a secure http only cookie and saved in the database).
  • Unified login system for support of multiple roles of users.
  • Validation using Joi.
  • Jest for unit and integration testing.
  • Entity folder/files generation with a custom script.
  • PM2 as a process manager.
  • Seeding data examples.
  • Logger with winston and morgan.
  • Errorhandling and a custom error catching method.
  • Filtering, sorting, field limiting, pagination.
  • Optional populate, select which fields to populate and which fields to return from GET requests.

create-express-ts-rest-api v1.0.0

21 Apr 03:17
Compare
Choose a tag to compare

Set up and build a Node.js REST API using Typescript, Express, Mongoose with a maintainable and scalable structure.

The project structure is based on MVC and follows it's basic principles but is a little bit different in which instead of having the entities logic spread out into specific folders (models folder containing all models, controllers folder containing all controllers etc...).

Each entity has it's own folder containing all it's core logic in isolation from other entities. Let's take the User entity as an example:

src
└── entities
    └── user
        ├── constants.ts
        ├── controller.ts
        ├── endpoints.ts
        ├── interface.ts
        ├── model.ts
        └── validation.ts

With this structure it is easier to maintain and scale with multiple entities (you will rarely have to switch between folders in order to manage one entity).

The project comes with many built-in features, such as:

  • Authentication with JWT: providing both an access token and refresh token (sent as a secure http only cookie and saved in the database).
  • Unified login system for support of multiple roles of users.
  • Validation using Joi.
  • Jest for unit and integration testing.
  • Entity folder/files generation with a custom script.
  • PM2 as a process manager.
  • Seeding data examples.
  • Logger with winston and morgan.
  • Errorhandling and a custom error catching method.
  • Filtering, sorting, field limiting, pagination.
  • Optional populate, select which fields to populate and which fields to return from GET requests.