Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

add httpd script

  • Loading branch information...
commit 4bb7e73cefe5b3fb28b07f18d4dfed2d06cf97e3 1 parent f147735
@Gonzih authored
Showing with 20 additions and 0 deletions.
  1. +20 −0 scripts/httpd.coffee
View
20 scripts/httpd.coffee
@@ -0,0 +1,20 @@
+# A simple interaction with the built in HTTP Daemon
+spawn = require('child_process').spawn
+
+module.exports = (robot) ->
+
+ robot.router.get "/hubot/version", (req, res) ->
+ res.end robot.version
+
+ robot.router.post "/hubot/ping", (req, res) ->
+ res.end "PONG"
+
+ robot.router.get "/hubot/time", (req, res) ->
+ res.end "Server time is: #{new Date()}"
+
+ robot.router.get "/hubot/info", (req, res) ->
+ child = spawn('/bin/sh', ['-c', "echo I\\'m $LOGNAME@$(hostname):$(pwd) \\($(git rev-parse HEAD)\\)"])
+
+ child.stdout.on 'data', (data) ->
+ res.end "#{data.toString().trim()} running node #{process.version} [pid: #{process.pid}]"
+ child.stdin.end()
Please sign in to comment.
Something went wrong with that request. Please try again.