Version 2.2 of Foal has been released! Here are the improvements that it brings.
The output of the
createapp command has been prettified to be more “welcoming”.
When building a SPA with cookie-based authentication, it can sometimes be difficult to know if the user is logged in or to obtain certain information about the user (
Since the authentication token is stored in a cookie with the
httpOnly directive set to
true (to mitigate XSS attacks), the front-end application has no way of knowing if a user is logged in, except by making an additional request to the server.
To solve this problem, version 2.2 adds a new option called
userCookie that allows you to set an additional cookie that the frontend can read with the content you choose. This cookie is synchronized with the session and is refreshed at each request and destroyed when the session expires or when the user logs out.
In the following example, the
user cookie is empty if no user is logged in or contains certain information about him/her otherwise. This is particularly useful if you need to display UI elements based on user characteristics.
Like the command
g rest-api now supports nested routes.
Let’s say we have the following file structure:
Running these commands will add and register the following files:
Source: Echo Js