Skip to content

Conversation

@emmadesilva
Copy link
Member

@emmadesilva emmadesilva commented Jul 16, 2024

Creates a new system to instead of hardcoding virtual routes, we store them in the service container (which is loaded when the router boots)

This means it's also possible for package developers to add realtime compiler routes:

<?php

namespace App\Providers;

use Illuminate\Support\ServiceProvider;
use Hyde\RealtimeCompiler\RealtimeCompiler;

class AppServiceProvider extends ServiceProvider
{
    /**
     * Bootstrap any application services.
     */
    public function boot(): void
    {
        $router = $this->app->make(RealtimeCompiler::class);

        $router->registerVirtualRoute('/foo', callable(\Desilva\Microserve\Request): \Desilva\Microserve\Response);
    }
}

@codecov
Copy link

codecov bot commented Jul 16, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 99.93%. Comparing base (8c806a9) to head (8ca3da8).
Report is 1 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff            @@
##             master    #1858   +/-   ##
=========================================
  Coverage     99.93%   99.93%           
  Complexity     1764     1764           
=========================================
  Files           182      182           
  Lines          4704     4704           
=========================================
  Hits           4701     4701           
  Misses            3        3           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@emmadesilva emmadesilva force-pushed the deeper-realtime-compiler-integration branch 3 times, most recently from 5b841b8 to 508625e Compare July 16, 2024 11:52
@emmadesilva emmadesilva force-pushed the deeper-realtime-compiler-integration branch 3 times, most recently from d584648 to 31b0462 Compare July 16, 2024 13:02
@emmadesilva
Copy link
Member Author

We can actually change this to target the master branch as it's more compatible than I expected.

@emmadesilva emmadesilva changed the title [2.x] Deeper realtime compiler integration [2.x] Refactor the realtime compiler to handle virtual routes through the service container Jul 17, 2024
@emmadesilva emmadesilva force-pushed the deeper-realtime-compiler-integration branch from 58d902b to 097bcfb Compare July 17, 2024 11:14
@emmadesilva emmadesilva changed the title [2.x] Refactor the realtime compiler to handle virtual routes through the service container Refactor the realtime compiler to handle virtual routes through the service container Jul 17, 2024
@emmadesilva emmadesilva changed the base branch from 2.x-dev to master July 17, 2024 11:14
@emmadesilva
Copy link
Member Author

Rebased to target master branch

It's possible the usage desires an overwrite. It should be up to the registration logic to determine if a page should be added
@emmadesilva emmadesilva changed the title Refactor the realtime compiler to handle virtual routes through the service container Refactor realtime compiler to handle virtual routes through service container Jul 17, 2024
@emmadesilva emmadesilva changed the title Refactor realtime compiler to handle virtual routes through service container Refactor realtime compiler to handle virtual routes through the service container Jul 17, 2024
@emmadesilva emmadesilva marked this pull request as ready for review July 17, 2024 11:24
@emmadesilva emmadesilva merged commit e0760a9 into master Jul 17, 2024
@emmadesilva emmadesilva deleted the deeper-realtime-compiler-integration branch July 17, 2024 11:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants