InterNACHI / modular

Modularize your Laravel application
MIT License
796 stars 65 forks source link

Modules API routes not working #97

Closed kennethsantianez closed 5 months ago

kennethsantianez commented 6 months ago

Hi, first of all thank you for a wonderful package.

I am planning to build a modularize application as an api endpoints only.

I have successfully created a sub module, named Sitio. Below is my code inside the generated default filename: sitio-routes.php

use BarangayESystemToolApp\Sitio\Http\Controllers\Api\V1\SitioController;
use Illuminate\Support\Facades\Route;

Route::middleware('api')->group( function() {

    Route::prefix('v1')->group( function(){

        // sitios
        Route::apiResource('sitios', SitioController::class);

    });

});

But the output of the command: php artisan route:list, did not add the middleware api for the above route. I suspect that the api middleware didn't work. What configuration do I need to add on my setup, so api middleware will function?

There is no context in the documentation related to api routing as well.

Can anyone point me to the right direction or did I miss something? Your help is highly appreciated.

bartdenhoed commented 5 months ago

Hi Kenneth,

Came across this issue because I happened to have the same question. Any chance you might have already solved the issue and can share it with me (and the world)?

Filefabrik commented 5 months ago

I have for your requirements an solution. give me 2-3 days to implement the whish from kennethsantianez

please let me know the structure of your package

your-package/routes/... your naming conventions, perhaps a screenshot is enough 2024-06-20_12-10

bartdenhoed commented 5 months ago

please let me know the structure of your package

Currently I use this structure. Is this enough for you?

Filefabrik commented 5 months ago

yes thats enough

then I'll set up bootraiser so that your requirements work. I'm working on the adjustable routes at the moment anyway

protected function bootingRoutes(?PackageConfig $packageConfig = null): void

inxilpro commented 5 months ago

All modular does is require the route file, so I don't think this is a modular issue. Is it possible that old routes are cached? Try php artisan route:clear and see if that fixes it…

bartdenhoed commented 5 months ago

Right, I think it was something with caching because I don't have this issue anymore.