문제

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

도움이 되었습니까?

해결책

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()
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top