Releases: iyifr/h4
Releases · iyifr/h4
v0.3.1
v0.3.0
- NEW Multiple Routers with
basePath
void main() async {
var app = createApp(
port: 5173,
onRequest: (event) {
// PER REQUEST local state😻
event.context["user"] = 'Ogunlepon';
setResponseHeader(event,
header: HttpHeaders.contentTypeHeader,
value: 'text/html; charset=utf-8');
},
afterResponse: (event) => {},
);
var router = createRouter();
var apiRouter = createRouter();
app.use(router, basePath: '/');
app.use(apiRouter, basePath: '/api');
router.get("/vamos/:id/base/:studentId", (event) {
return event.params;
});
apiRouter.get("/signup", (event) async {
var formData = await readFormData(event);
var username = formData.get('username');
var password = formData.get('password');
// userService.signup(username, password);
event.statusCode = 201;
return 'Hi from /api with $username, $password';
});
}
- NEW
readFormData
utility - familiar formdata parsing API
apiRouter.get("/signup", (event) async {
var formData = await readFormData(event);
var username = formData.get('username');
var password = formData.get('password');
// ALSO included..
var allNames = formdata.getAll('names') // return List<String>
userService.signup(username, password);
event.statusCode = 201;
return 'Hi from /api';
});
-
NEW
getRequestIp
andgetRequestOrigin
utilities -
PATCHED
H4Event
params now correctly parses more than one param in the route string. e.g
'/user/:userId/profile/:projectId'
-
PATCHED all bugs in the behaviour of param routes.
-
PATCHED
getRequestHeader
utility
v0.2.0
0.2.0
-
Minor Release
-
Improved CLI
- Added a new command H4 start which starts your app locally.
h4 start
or
dart pub global run h4:start
--dev flag
- Run the command with the --dev flag to restart the server when you make changes to your files
-
New Utilities
- getQuery
- setResponseHeader
- getHeader
-
v0.1.4
v0.1.3
Joint release, forgot to make the last one (sorry)
0.1.3
-
Patch Release
- Deprecated app.onRequest() signature for registering middleware.
- Added new signature for adding middleware to requests.
var app = createApp( port: 5173, onRequest: (event) => {}, onError: (error, stacktrace, event) => {}, afterResponse: (event) => {}, ); var router = createRouter(); app.use(router);
- Error handling in async handlers has been refactored and improved.
- Certain edge cases with wildcard routing patterns were addressed.
- Stream (SSE) implementation removed for now to study StreamSinks.
0.1.2
-
Patch Release
- Improved logic for re-assigning localhost port to start server on when designated port is in
use. - Added a naive stream (SSE) implementation.
- Improved logic for re-assigning localhost port to start server on when designated port is in
v0.1.1
v0.1.1
-
Patch Release
- When the port assigned to server is taken, it now informs you that the port is taken and tries
to start the server on port - (previousPort + 1). - Improved documentation comments for the added utilities in the last release.
- When the port assigned to server is taken, it now informs you that the port is taken and tries