Trailing Slash on Slim 4 Skeleton

After installation

composer create-project slim/slim-skeleton myslimsite

I added Trailing Slash Middleware

composer require middlewares/trailing-slash

Then I added the below line to app\middleware.php

<?php
declare(strict_types=1);

use App\Application\Middleware\SessionMiddleware;
use Slim\App;

use Middlewares\TrailingSlash;

return function (App $app) {
    $app->add(SessionMiddleware::class);
    $app->add(new TrailingSlash(false));
}

to remove the trailing slash from url, but it returns a 404 when accessing /users/

How to get this working?