diff --git a/example/app.lua b/example/app.lua index 10a11c0..ac05909 100644 --- a/example/app.lua +++ b/example/app.lua @@ -3,11 +3,18 @@ package.path = './src/?.lua;./src/?/init.lua;' .. package.path local Pegasus = require 'pegasus' local Compress = require 'pegasus.plugins.compress' +local Downloads = require 'pegasus.plugins.downloads' local server = Pegasus:new({ - port='9090', - location='/example/root/', - plugins = { Compress:new() } + port = '9090', + location = '/example/root/', + plugins = { + Downloads:new { + prefix = "downloads", + stripPrefix = true, + }, + Compress:new(), + } }) server:start(function(req) diff --git a/example/copas.lua b/example/copas.lua index 6af5cbf..f468fc4 100644 --- a/example/copas.lua +++ b/example/copas.lua @@ -11,6 +11,7 @@ package.path = "./src/?.lua;./src/?/init.lua;"..package.path local Handler = require 'pegasus.handler' local copas = require('copas') local socket = require('socket') +local Downloads = require 'pegasus.plugins.downloads' --- Creates a new server within the Copas scheduler. -- @tparam table opts options table. @@ -81,7 +82,12 @@ assert(newPegasusServer{ }, location = '/example/root/', callback = nil, - plugins = {}, + plugins = { + Downloads:new { + prefix = "downloads", + stripPrefix = true, + }, + }, }) -- Start diff --git a/example/root/index.html b/example/root/index.html index 74297ac..f890903 100644 --- a/example/root/index.html +++ b/example/root/index.html @@ -9,7 +9,9 @@
-Click the image to download it!