Skip to main content
Version: v2

Update Guide to Version 2

This guide will take you step by step through the upgrade to version 2. If something is missing or incorrect, feel free to submit an issue or a PR on Github.

Node versionsTS min version
10.x, 12.x, 14.x4.0

For all

Upgrade your versions of TypeScript and Node.JS if necessary.

New CLI commands

New configuration system

Application creation

By topic

Validation hooks

Authentication with sessions (session tokens) and CSRF protection

OpenAPI

Service and application initialization

File upload and download

JWT hooks and CSRF protection

Support of MongoDB

Error-handling and hook post functions

Template engine

Custom Express instance

Common issue

If you get unexpected errors when building the application, please check the following points:

  • You have updated all your @foal/x packages.
  • You have updated your typescript dependency to version 4.

Rare cases

  • The following objects and functions have been removed: ObjectDoesNotExist, isObjectDoesNotExist, PermissionDenied, isPermissionDenied, ValidationError, isValidationError, validate.
  • The legacy option has been removed from hashPassword and verifyPassword. If you used it, please submit an issue.
  • The command foal g sub-app has been removed.
  • The functions createService and createController do not accept a ServiceManager as second argument.
  • The @Hook decorator only accepts one function.
  • The type ExpressApplication = any has been removed.
  • The property req.foal.ctx does not exist anymore in post middlewares.