Skip to content

Releases: iyifr/h4

v0.3.1

08 Oct 20:01
Compare
Choose a tag to compare

0.3.1 (Patch)

  • EXTENDED readFormData utility to handle undefined formdata fields better.
  • PATCHED setResponseHeader utility to better handle immutable nature of http response
    headers.
  • Documented some utilities better.
  • Entire library is now accessible from one import.

v0.3.0

02 Sep 00:51
Compare
Choose a tag to compare
  • 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 and getRequestOrigin 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

30 Aug 10:46
Compare
Choose a tag to compare

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

29 Aug 13:02
Compare
Choose a tag to compare

0.1.4

  • H4 CLI.

    • Added a basic CLI that bootstraps a H4 app

      • The H4 init command bootstraps a full H4 app.
      dart pub global activate h4

      then run

      h4 init

      or

      dart pub global run h4:init
    • Removed compute dependency

v0.1.3

21 Aug 14:12
Compare
Choose a tag to compare

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.

v0.1.1

06 Jul 11:51
Compare
Choose a tag to compare
v0.1.1 Pre-release
Pre-release

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.