Excuse me, do you have a moment to talk about our Lord and Saviour, WP_Rewrite?
You know that part of every web based application where you tell it what to do when a request comes in on a certain URL? This is Express.js (a Node.js package)
app.get(‘/’, function (req, res) {
res.send(‘root’)
});
app.get(‘/about’, function (req, res) {
res.send(‘about’)
});
app.get(‘/users/:userId/books/:bookId’, function (req, res) {
res.send(req.params)
});
// Route path: /users/:userId/books/:bookId
// Request URL: http://localhost:3000/users/34/books/8989
// req.params: { "userId": "34", "bookId": "8989" }
This is Laravel:
$router->group([‘middleware’ => ‘web’], function ($router) {
// API Token Refresh…
$router->put( ‘/spark/token’, ‘TokenSecretController@refresh’ );
// API Settings
$router->get( ‘/settings/api/tokens’, ‘TokenSecretController@all’ );
$router->post( ‘/settings/api/token’, ‘TokenSecretController@store’ );
$router->put( ‘/settings/api/token/{token_id}’, ‘TokenSecretController@update’ );
$router->get( ‘/settings/api/token/abilities’, ‘TokenSecretAbilitiesController@all’ );
$router->delete( ‘/settings/api/token/{token_id}’, ‘TokenSecretController@destroy’ );
//
$router->get(
Source: https://managewp.org/articles/16119/excuse-me-do-you-have-a-moment-to-talk-about-our-lord-and-saviour-wp-rewrite
source https://williechiu40.wordpress.com/2017/09/17/excuse-me-do-you-have-a-moment-to-talk-about-our-lord-and-saviour-wp_rewrite/