Question

By default, hubot httpd.coffee script puts a pre tag in the output. Is there anyway to remove it? I'm trying to make hubot generate some basic html pages.

spawn = require('child_process').spawn
Fs   = require 'fs'

module.exports = (robot) ->
    robot.router.get "/", (req, res) ->
        res.end "Hi, i am a <b>robot</b>!"

the output, in the web page, must be like: Hi, i am a robot

Was it helpful?

Solution

Hubot's HTTP server is based on ExpressJS, so I suggest reading this guide: http://expressjs.com/guide.html

You can try using res.send:

spawn = require('child_process').spawn
Fs   = require 'fs'

module.exports = (robot) ->
    robot.router.get "/", (req, res) ->
        res.send "Hi, i am a <b>robot</b>!"
        res.end()
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top