Skip to content

Next

  • Projects
  • Groups
  • Snippets
  • Help
  • Sign in / Register
Minds Backend - Engine
Minds Backend - Engine
  • Project overview
  • Repository
  • Issues 298
  • Merge Requests 40
  • CI / CD
  • Security & Compliance
  • Packages
  • Wiki
  • Snippets
  • Members
  • Collapse sidebar
  • Graph
  • Charts
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
  • Minds
  • Minds Backend - EngineMinds Backend - Engine
  • Merge Requests
  • !342

Open
Opened 1 month ago by Emiliano Balbuena@edgebal
Report abuse

WIP: (feat): Modernize Router (&75)

Edited 1 month ago by Emiliano Balbuena
Request to merge epic/modern-router into master
The source branch is 16 commits behind the target branch
Open in Web IDE
Pipeline #93915418 failed for f55c8ed2 on epic/modern-router
          Requires 2 more approvals from Devs and Deployers.
          Marcelo Rivera
          Marcelo Rivera
          Rami Albatal
          Rami Albatal
          Ben Hayward
          Ben Hayward
          Mark Harding
          Mark Harding
          Martin Santangelo
          Martin Santangelo
          There are merge conflicts. Resolve these conflicts or ask someone with write access to this repository to merge it locally

          Deletes source branch

          You can merge this merge request manually using the
          • Discussion 7
          • Commits 16
          • Pipelines 15
          • Changes 39
          1/6 threads resolved
          • Emiliano Balbuena @edgebal added MR::Requires Changes Sprint::09/25 - Oldfashioned Owl scoped labels 1 month ago

            added scoped labels

          • Emiliano Balbuena @edgebal changed title from WIP: (feat): Modernize Router to WIP: (feat): Modernize Router{+ (&75)+} 1 month ago

            changed title from WIP: (feat): Modernize Router to WIP: (feat): Modernize Router{+ ()+}

          • Mark Harding
            Mark Harding @markeharding started a thread on an old version of the diff 1 month ago
            Resolved by Emiliano Balbuena 1 month ago
          • Emiliano Balbuena @edgebal resolved all threads 1 month ago

            resolved all threads

          • Emiliano Balbuena @edgebal added 9 commits 1 month ago

            added 9 commits

            • 3fc05260...26e56438 - 7 commits from branch master
            • fe291dec - Merge remote-tracking branch 'origin/master' into epic/modern-router
            • 1a8be8b6 - (wip): Module Router

            Compare with previous version

          • Emiliano Balbuena @edgebal added 69 commits 2 weeks ago

            added 69 commits

            • 1a8be8b6...fb4bc4e6 - 68 commits from branch master
            • e7c5938f - Merge remote-tracking branch 'origin/master' into epic/modern-router

            Compare with previous version

          • Emiliano Balbuena @edgebal added 1 commit 2 weeks ago

            added 1 commit

            • 01eaaffb - (wip): Routes matcher and dispatcher

            Compare with previous version

          • Emiliano Balbuena @edgebal added 1 commit 2 weeks ago

            added 1 commit

            • 98c08123 - (feat): Module routes matcher & dispatcher; exception handling

            Compare with previous version

          • Emiliano Balbuena @edgebal added 1 commit 1 week ago

            added 1 commit

            • 4530948d - (fix): Serve static content when accepting text/html

            Compare with previous version

          • Emiliano Balbuena @edgebal added 1 commit 1 week ago

            added 1 commit

            • ea3f73c6 - (refactor): Streamline middleware and request handler

            Compare with previous version

          • Emiliano Balbuena @edgebal added 1 commit 1 week ago

            added 1 commit

            • 4129364c - (chore): Strict mode and lint

            Compare with previous version

          • Emiliano Balbuena @edgebal added 1 commit 1 week ago

            added 1 commit

            • c5e1a351 - (wip): Admin and LoggedIn middleware

            Compare with previous version

          • Emiliano Balbuena @edgebal added 1 commit 1 week ago

            added 1 commit

            • 2e8c8fcd - (chore): Remove unwanted dep from composer.lock

            Compare with previous version

          • Emiliano Balbuena @edgebal added 1 commit 1 week ago

            added 1 commit

            • f697713e - (fix): PHP strict errors; (chore): Feeds\Activity routes

            Compare with previous version

          • Emiliano Balbuena @edgebal added 8 commits 1 week ago

            added 8 commits

            • f697713e...c3a7551e - 7 commits from branch master
            • bc0b7654 - Merge remote-tracking branch 'origin/master' into epic/modern-router

            Compare with previous version

          • Emiliano Balbuena @edgebal added 18 commits 6 days ago

            added 18 commits

            • bc0b7654...af77626a - 17 commits from branch master
            • 2d8854b8 - Merge remote-tracking branch 'origin/master' into epic/modern-router

            Compare with previous version

          • Emiliano Balbuena @edgebal added 1 commit 6 days ago

            added 1 commit

            • 13c0d96f - (chore): Short-circuit pre-PSR7 router

            Compare with previous version

          • Emiliano Balbuena @edgebal added 1 commit 6 days ago

            added 1 commit

            • f55c8ed2 - (feat): Sessions and XSRF

            Compare with previous version

          • Mark Harding
            Mark Harding @markeharding started a thread on the diff 44 minutes ago
            Core/Di/Ref.php
            1 <?php
            2 /**
            3 * Ref
            • Mark Harding
              Mark Harding @markeharding · 44 minutes ago
              Owner

              Can we explain in this doc header what this class does and what it can be used for?

            • Please register or sign in to reply
          • Mark Harding
            Mark Harding @markeharding started a thread on the diff 44 minutes ago
            Core/Feeds/Routes.php
            8
            9 use Minds\Core\Di\Ref;
            10 use Minds\Core\Router\Middleware\LoggedInMiddleware;
            11 use Minds\Core\Router\ModuleRoutes;
            12 use Minds\Core\Router\Route;
            13
            14 class Routes extends ModuleRoutes
            15 {
            16 /**
            17 * Registers all module routes
            18 */
            19 public function register(): void
            20 {
            21 $this->route
            22 ->withPrefix('api/v3/newsfeed')
            23 ->using([
            • Mark Harding
              Mark Harding @markeharding · 44 minutes ago
              Owner

              can we change ->using to withMiddleware?

            • Please register or sign in to reply
          • Mark Harding
            Mark Harding @markeharding started a thread on the diff 44 minutes ago
            Core/Router.php
            147 if (method_exists($handler, $method)) {
            148 // Set the request
            149 if (method_exists($handler, 'setRequest')) {
            150 $handler->setRequest($request);
            151 }
            152 // Set the response
            153 if (method_exists($handler, 'setResponse')) {
            154 $handler->setResponse($response);
            155 }
            156
            157 return $handler->$method($pages);
            158 } else {
            159 exit;
            160 }
            31 /** @var Dispatcher $dispatcher */
            32 $dispatcher = Di::_()->get('Router');
            • Mark Harding
              Mark Harding @markeharding · 44 minutes ago
              Owner

              should this not be injected with the constructor so we can spec test?

            • Please register or sign in to reply
          • Mark Harding
            Mark Harding @markeharding started a thread on the diff 44 minutes ago
            Core/Router/Route.php
            19 */
            20 class Route
            21 {
            22 use MagicAttributes;
            23
            24 /** @var string */
            25 protected $prefix = '/';
            26
            27 /** @var string[] */
            28 protected $middleware = [];
            29
            30 /** @var Registry */
            31 protected $registry;
            32
            33 /** @var string[] */
            34 const ALLOWED_METHODS = ['get','post','put','delete'];
            • Mark Harding
              Mark Harding @markeharding · 44 minutes ago
              Owner

              options?

            • Please register or sign in to reply
          • Mark Harding
            Mark Harding @markeharding started a thread on the diff 44 minutes ago
            Core/Router/Route.php
            47 * @param string $prefix
            48 * @return Route
            49 */
            50 public function withPrefix(string $prefix): Route
            51 {
            52 $instance = clone($this);
            53 $instance->setPrefix(sprintf("/%s/%s", trim($instance->getPrefix(), '/'), trim($prefix, '/')));
            54
            55 return $instance;
            56 }
            57
            58 /**
            59 * @param string[] $middleware
            60 * @return Route
            61 */
            62 public function using(array $middleware): Route
            • Mark Harding
              Mark Harding @markeharding · 44 minutes ago
              Owner

              change to withMiddleware?

            • Please register or sign in to reply
          • Mark Harding
            Mark Harding @markeharding · 44 minutes ago
            Owner

            This is looking great. Can we get some spec tests in here too?

          Please register or sign in to reply
          Assignee
          Emiliano Balbuena's avatar
          Emiliano Balbuena @edgebal
          None
          Milestone
          None
          Time tracking
          No estimate or time spent
          2
          Labels
          MR::Requires Changes Sprint::09/25 - Oldfashioned Owl
          Lock merge request
          Unlocked
          7
          7 participants
          user avatar
          Marcelo Rivera
          user avatar
          Rami Albatal
          user avatar
          Ben Hayward
          user avatar
          Mark Harding
          user avatar
          Martin Santangelo
          user avatar
          Brian Hatchet
          user avatar
          Emiliano Balbuena
          Reference: minds/engine!342