Skip to content

Commit

Permalink
Plugin howto added again
Browse files Browse the repository at this point in the history
  • Loading branch information
Aglezabad committed Apr 7, 2017
1 parent 2438b37 commit 16a3715
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 33 deletions.
42 changes: 42 additions & 0 deletions README.md
Expand Up @@ -10,6 +10,48 @@

<!-- /BADGES -->

## 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
```

<!-- INSTALL/ -->

Expand Down
33 changes: 0 additions & 33 deletions project.geany

This file was deleted.

0 comments on commit 16a3715

Please sign in to comment.