diff --git a/guides/plugin/readme.md b/guides/plugin/readme.md index 2256a08..6256029 100644 --- a/guides/plugin/readme.md +++ b/guides/plugin/readme.md @@ -50,6 +50,19 @@ Plugins.register(:my_custom_plugin, MyCustomPlugin) To load and use a plugin in your Lennarb application, call the plugin method in your application class. +```ruby +Lennarb.new do |app| + app.plugin :my_custom_plugin + + app.get '/custom' do |req, res| + res.status = 200 + res.html(custom_method) + end +end +``` + +And if you are using the `Lennarb::Application::Base` class, you can use the `plugin` method directly in your application class. + ```ruby class MyApp < Lennarb::Application::Base plugin :my_custom_plugin diff --git a/readme.md b/readme.md index 2678ba6..95461fa 100644 --- a/readme.md +++ b/readme.md @@ -40,6 +40,8 @@ Plese see [Performance](https://aristotelesbr.github.io/lennarb/guides/performan - [Performance](https://aristotelesbr.github.io/lennarb/guides/performance/index.html) - The **Lennarb** is very fast. The following benchmarks were performed on a MacBook Pro (Retina, 13-inch, Early 2013) with 2,7 GHz Intel Core i7 and 8 GB 1867 MHz DDR3. Based on [jeremyevans/r10k](https://github.com/jeremyevans/r10k) using the following [template build](static/r10k/build/lennarb.rb). + - [Plugin](https://aristotelesbr.github.io/lennarb/guides/plugin/index.html) - You can create your plugins to extend the functionality of the framework. + - [Response](https://aristotelesbr.github.io/lennarb/guides/response/index.html) - This is the response guide. The `res` object is used to send a response to the client. The Lennarb use a custom response object to send responses to the client. The `res` object is an instance of `Lennarb::Response`.