简体   繁体   中英

How can I remove the “<pre>” tags in Hubot httpd script?

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

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()

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM