How to create a username in route

Please how can i be able to create a username in my route. example domain.com/username

Do you not need a password? Normally a form is used to create a new user with a password and is posted via a route to a controller, and the password is bcrypted. Study the manual on https://book.cakephp.org/3.0/en/controllers/components/authentication.html

Ok, what I really need is a username route like Facebook.com/username

You can try this but you have to handle it with care because if this route will conflict with others you will get an error page.
You just have to build a method which will take a parameter the username. e.g. you can build a profile method in users controller and the route will be like.

$routes->connect(’/:username’,[‘controller’ => ‘Users’, ‘action’ => ‘profile’],[‘pass’ => [‘username’]]);

What i did before now is this
Router::connect(’/-:username’,
array(
‘controller’=>‘users’,
‘action’=>‘view’
),
array(
‘pass’ => array(‘username’),
‘username’ => ‘\b(?:(?!admin|items|images)\w)+\b’
)
);
But i want to remove this connect(’/-: , the dash, each time i remove it, i will have an error.
I want it to be like this connect(’/:username

Working fine for me without “-”.

ok Thanks. I will try it again and get back to you.