Answer the question
In order to leave comments, you need to log in
How can I write routing on slim?
There is a task on the slim to write api. Method for user login and adding pictures.
I wrote a login html and a class with a method that logs in. How can I connect this in routing?
To be displayed when typing /login html form and after sending refer to my login verification method
Answer the question
In order to leave comments, you need to log in
GET request will get the login form, POST will log in. The form should accordingly have method=post.
$app = new \Slim\App();
$app->get('/login', function ($request, $response, $args) {
// login page
});
$app->post('/login', function ($request, $response, $args) {
// do login, redirect to main page
});
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question