Skip to content

πŸ”€ Router Module For Nestjs Framework 🐯

License

Notifications You must be signed in to change notification settings

unistate/nest-router

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

4 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Nest Router

πŸ”€ Router Module For Nestjs Framework 🐯

UC

It still under construction, but here is a simple example of what I Do

import { NestFactory } from '@nestjs/core';
import { ApplicationModule } from './app/app.module';
import { RouterModule, Routes } from '../' // it's what we are building
import { CatsController } from './app/cats/cats.controller';
import { DogsController } from './app/dogs/dogs.controller';
import { NinjaController } from './app/ninja/ninja.controller';
async function bootstrap() {
  const app = await NestFactory.create(ApplicationModule);
  const routes: Routes = [{
    path: '/ninja',
    controller: NinjaController,
    children: [{
      path: '/dogs',
      controller: DogsController
    }, {
      path: '/cats',
      controller: CatsController
    }]
  }]
  new RouterModule(NestFactory).forRoutes(routes);
  await app.listen(3000);
}
bootstrap();

the result will be

- /ninja
-- /dogs
-- /cats
/ninja -> NinjaController
/ninja/dogs -> DogsController
/ninja/cats -> CatsController

You get the Idea ..

About

πŸ”€ Router Module For Nestjs Framework 🐯

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published