Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/mnavarrocarter/amp-http-router
An asynchronous HTTP routing engine for Amp based applications
https://github.com/mnavarrocarter/amp-http-router
amphp amphp-http express http middleware router
Last synced: about 1 month ago
JSON representation
An asynchronous HTTP routing engine for Amp based applications
- Host: GitHub
- URL: https://github.com/mnavarrocarter/amp-http-router
- Owner: mnavarrocarter
- Created: 2020-08-28T16:21:05.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2020-09-05T15:44:12.000Z (over 4 years ago)
- Last Synced: 2024-11-14T22:36:48.151Z (about 1 month ago)
- Topics: amphp, amphp-http, express, http, middleware, router
- Language: PHP
- Homepage:
- Size: 11.7 KB
- Stars: 1
- Watchers: 3
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
AMP HTTP Router
===============A high performance routing engine that handles requests for an Amp HTTP Server inspired in
Express JS.## Installation
```bash
composer require mnavarrocarter/amp-http-router
```
## Quick Start```php
getParam('id');
return html(sprintf('The user id is %s', $id));
}$router = Router::create();
$router->get('/', handleFunc('homepage'));
$router->get('/users/:id', handleFunc('findUser'));Amp\Loop::run(fn() => yield listenAndServe('0.0.0.0:8000', $router));
```### Router Composition
You can have multiple routers mounted to different paths for more efficient
routing:```php
mount('/api', $api);
```