Puro REST Framework
  • Getting started
  • Architecture and Protocol
  • Entities
  • Controllers
  • Plugins
Powered by GitBook
On this page

Was this helpful?

Plugins

Defining a plugin

TODO

import { BookController } from './controllers/BookController';
import { BookCollectionController } from './controllers/BookCollectionController';

import { Book } from './entities/Book';

import { Plugin, getRepository } from '@puro/core';

export class BookPlugin extends Plugin {
  protected getServices() {
    return {
      bookRepository: async () => getRepository(Book)
    };
  }

  protected getRoutes() {
    return [
      { path: '/books/:bookId', controller: BookController },
      { path: '/books', controller: BookCollectionController }
    ];
  }
}
PreviousControllers

Last updated 6 years ago

Was this helpful?