express-sweet
Advanced tools
Changelog
[2.0.5] - 2025/2/4
Added a Handlebars helper, available for use in views, to replace HTML tags in a string.
Example:
{{!-- results in: lorem ipsum dolor sit amet --}}
{{{stripTags '<a href="https://example.com">lorem ipsum <strong>dolor</strong> <em>sit</em> amet</a>'}}}
{{!-- results in: lorem ipsum <strong>dolor</strong> sit amet --}}
{{{stripTags '<a href="https://example.com">lorem ipsum <strong>dolor</strong> <em>sit</em> amet</a>' '<strong>' ''}}}
{{!-- results in: 🍩lorem ipsum 🍩dolor🍩 🍩sit🍩 amet🍩 --}}
{{{stripTags '<a href="https://example.com">lorem ipsum <strong>dolor</strong> <em>sit</em> amet</a>' [] '🍩'}}}
Changelog
[2.0.4] - 2025/1/14
<!-- ## [2.0.4] - Unreleased -->exceptions
to errors
.hasMany
association with the findAll
method.findObjectInArray
Handlebars helper: This helper is added to the view, allowing you to find an object in an array based on a specified field name and value.
{{!--
items is an array of objects: [{id: 123, name: 'Item A'}, {id: 456, name: 'Item B'}]
This code will output: "Item A"
--}}
{{#each items}}
{{#if (eq id 123)}}
{{lookup (findObjectInArray ../items 'id' id) 'name'}}
{{/if}}
{{/each}}
Changelog
[2.0.3] - 2024/9/3
"type": "module"
to the package.json
of the esm app generated by express-sweet-generator
. It is fully esm compliant.require
was changed to dynamic import.express-hbs
to express-handlebars
.block
and contentFor
helpers are still available.database/Database
has been changed from a sequelize.Sequelize
instance to a sequelize.Sequelize
class. If you use it in the future, you need to instantiate it.mount()
changed from void
to Promise<void>
.middlewares/CORS.mount()
changed from void
to Promise<void>
.middlewares/Environment.mount()
changed from void
to Promise<void>
.middlewares/ErrorHandler.mount()
changed from void
to Promise<void>
.middlewares/Http.mount()
changed from void
to Promise<void>
.middlewares/Local.mount()
changed from void
to Promise<void>
.middlewares/Router.mount()
changed from void
to Promise<void>
.middlewares/View.mount()
changed from void
to Promise<void>
.middlewares/View.mountBeforeRender()
changed from void
to Promise<void>
.middlewares/Authentication.mount()
changed from void
to Promise<void>
.utils/loadAuthenticationConfig()
changed from AuthenticationConfig
to Promise<AuthenticationConfig>
.utils/loadBasicConfig()
changed from BasicConfig
to Promise<BasicConfig>
.utils/loadDatabaseConfig()
changed from sequelize.Options
to Promise<sequelize.Options>
.utils/loadViewConfig()
changed from ViewConfig
to Promise<ViewConfig>
.services/Authentication.successRedirect()
changed from void
to Promise<void>
.services/Authentication.failureRedirect()
changed from void
to Promise<void>
.database/Model.initialize()
changed from typeof Model
to Promise<typeof Model>
.database/loadModels()
changed from void
to Promise<void>
.const expressExtension = require('express-sweet');
// Create Database instance.
const config = await expressExtension.utils.loadDatabaseConfig();
const database = new expressExtension.database.Database(config.database, config.username, config.password, config);
// Check database connection.
await database.isConnect();
const expressExtension = require('express-sweet');
// Check database connection.
await expressExtension.database.Database.isConnect();
Changelog
[2.0.2] - 2024/9/1
Changelog
[2.0.0] - 2024/3/24
services.AWSRekognitionClient
and services.AWSSesClient
have been migrated to the AWS SDK Extension NPM package, so please install from there if needed.Changelog
[1.1.1] - 2024/3/23
config/authentication.js#cookie_secure
) and the application is running on the HTTP protocol, the following warning message is output upon user authentication.
Warning: Cookie security must be disabled for user authentication to work over the HTTP protocol (config/authentication.js#cookie_secure)
Changelog
[1.0.44] - 2023/12/30
Secure
and HttpOnly
attributes of the session cookie can now be set from the authentication configuration file (config/authentication.js
).Changelog
[1.0.43] - 2023/12/30
cookie_name
field of the authentication configuration file (config/authentication.js
).