Skip to content
This repository has been archived by the owner on Jul 17, 2024. It is now read-only.

Commit

Permalink
demo overhaul
Browse files Browse the repository at this point in the history
  • Loading branch information
Burnett01 committed Dec 26, 2015
1 parent 67b0d11 commit 11066bc
Showing 1 changed file with 36 additions and 0 deletions.
36 changes: 36 additions & 0 deletions examples/test.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,13 @@ API = require '../src/API'

api = new API({})

# optional: pass an object for restify's createServer-function
# http://restify.com/#creating-a-server
# example: api = new API({ name: 'MyApp' })


# ´´´´´´´ PLUGIN SETUP ´´´´´´´

# => Authorization

api.auth({
Expand All @@ -21,13 +28,34 @@ api.cors({
enabled: false
})

# => BodyParser

api.bodyParser({
enabled: true
})


# ´´´´´´´ DEMO ROUTES ´´´´´´´

#<-- Desc: Health-Status | Path: /heartbeat -->#

# Simple GET-Response

api.get('/heartbeat', (req, res, next) ->
api.response(req, res, next, "dub")
)

# Simple POST-Response
# Access POST-values via req.body.value

api.post('/heartbeat', (req, res, next) ->
api.response(req, res, next, req.body)
)


# ´´´´´´´ ADDON ROUTES ´´´´´´´
# Each route correspondens to an addon
# Check the src/addon/ folder for more information

#<-- Addon: Net | Path: /net -->#

Expand All @@ -51,6 +79,12 @@ api.get('/net/isv6/:ip', (req, res, next) ->

#<-- Addon: FS | Path: /fs -->#

api.post('/fs/readfile', (req, res, next) ->
api.fs.readFile(req.body.path, (err, content) ->
next.ifError(err)
api.response(req, res, next, content)
)
)

#<-- Addon: OS | Path: /os/users -->#

Expand Down Expand Up @@ -239,5 +273,7 @@ api.get('/os/system/netfilter/ip_conntrack_count', (req, res, next) ->
)


# ´´´´´´´ HIT IT UP! ´´´´´´´

api.connect(8080)

0 comments on commit 11066bc

Please sign in to comment.