简体   繁体   中英

Node.js with CoffeeScript, how to debug?

I am used to being a Front-End Developer. I am new to NodeJS.

I always use CoffeeScript to build Front-end code.

I have a coffeescript file like the following:

http = require 'http'

http.createServer (req, res) ->
  res.writeHead 200, {'Content-Type': 'text/plain'}
  res.end 'Hello World\n'
.listen 1337

console.log 'Server running at http://127.0.0.1:1337/'

So I type command $ coffee server.coffee , It works fine, the same effect with $ node server.js

So I decided I write my NodeJS application using CoffeScript, When I deploy it to the production environment I will compile all CoffeeScript files to Javascript files.

So:

  1. I don't know how to debug CoffeeScript.

  2. I am studying NodeJS by myself, I don't know if the above steps are correct or reasonable

This took me forever to figure out.

coffee --nodejs debug server.coffee

Apparently you can pass options to node by specifying the --nodejs flag. More on that in this other post

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