diff --git a/README.md b/README.md index f510b10..0eb1709 100644 --- a/README.md +++ b/README.md @@ -10,6 +10,48 @@ +## How to use the plugin + +* First, you need to create a Javascript file inside your Docpad project. +You must create that as a NodeJS module. Check the next example: + +``` javascript +module.exports = function (opts, baseApiUrl) { + var server = opts.server + + server.get(baseApiUrl + '/test', function (req, res, next) { + return res.json({ + test: 'OK' + }) + }) + + server.get(baseApiUrl + '/bbbb', function (req, res, next) { + var err = new Error() + next(err) + }) +} +``` + +* Finally, you have to put the path of the file in Docpad configuration file: + +``` coffee-script +# DocPad Configuration File +# http://docpad.org/docs/config + +# Define the DocPad Configuration +docpadConfig = { + # Plugins configuration + plugins: + api: + baseApiUrl: '/APIURLTEST' + source: [ + file: 'api/api-test.js' + ] +} + +# Export the DocPad Configuration +module.exports = docpadConfig +``` diff --git a/project.geany b/project.geany deleted file mode 100644 index 476b81d..0000000 --- a/project.geany +++ /dev/null @@ -1,33 +0,0 @@ -[editor] -line_wrapping=false -line_break_column=72 -auto_continue_multiline=true - -[file_prefs] -final_new_line=true -ensure_convert_new_lines=false -strip_trailing_spaces=false -replace_tabs=false - -[indentation] -indent_width=4 -indent_type=1 -indent_hard_tab_width=8 -detect_indent=false -detect_indent_width=false -indent_mode=2 - -[project] -name=API (Docpad Plugin) -base_path=/home/angel/Proyectos/Software/docpad-plugin-api - -[long line marker] -long_line_behaviour=1 -long_line_column=72 - -[files] -current_page=0 -FILE_NAME_0=258;CoffeeScript;0;EUTF-8;1;1;0;%2Fhome%2Fangel%2FProyectos%2FSoftware%2Fdocpad-plugin-api%2Fsrc%2Fapi.plugin.coffee;0;4 - -[VTE] -last_dir=/home/angel