console.log() how...?

38 views
Skip to first unread message

Anthony Kerz

unread,
Apr 23, 2013, 10:22:45 PM4/23/13
to script...@googlegroups.com

just picking up scripted again after a while.

going through a node tutorial where the first exercise is:

console.log('hello world');

so i edited helloworld.js up in scripted and hit run and kind of expected 'hello world' to show up in the bottom console,
but am just seeing:

Now serving /Users/tony/scr-test on http://localhost:8000

where would console output go in this scenario?

on what is probably an unrelated note, 'console' is red-x'd with 'console not defined',
what would i need to do to address that?

regards,
tony.

Message has been deleted

Anthony Kerz

unread,
Apr 23, 2013, 10:29:42 PM4/23/13
to script...@googlegroups.com

on a related note, the next little tutorial bit:

var http = require("http");

http.createServer(function(request, response) {
  response.writeHead(200, {"Content-Type": "text/plain"});
  response.write("Hello World");
  response.end();
}).listen(8888);

shows 'require' as undefined, what would i need to do for that?

regards,
tony.

Andrew Clement

unread,
Apr 24, 2013, 1:00:38 PM4/24/13
to script...@googlegroups.com
The 'play' button at the top starts an embedded server which serves your project (with reloading support). See the notes on 'integrated server' in the release notes: http://scripted-editor.github.io/scripted/release_notes/0_4_0/scripted_0_4_0.html . It is useful for checking pure client side apps (on the server that is launched you can visit the html of your app).
It doesn't run your node app but we have a github issue for it to do that as an alternative.

cheers,
Andy

Andrew Clement

unread,
Apr 24, 2013, 1:13:01 PM4/24/13
to script...@googlegroups.com
You need to tell jshint (which scripted is using) that you are writing a node app. 
Either via this at the top of your file:

/*jshint node:true*/

or by creating a .jshintrc file in your project base directory containing:

{
  "node":true
}

and then reloading the page. A .jshintrc file will apply to all files in your project.

Andy

Anthony Kerz

unread,
Apr 24, 2013, 11:21:57 PM4/24/13
to script...@googlegroups.com
thanks andy, dot-jshintrc works like a champ!

i know it probably seems like people do more 'complaining' in terms of issues and such, 
but i have to say i really like the rich feature-set and snappy-ness of the editor and 
just scanning the release notes gives me a flavor for how much ground you guys are covering.

i think developers may tend to get spoiled with editors and take for granted what goes into them,
but i attended your session at spring-one last year and it gave me a new appreciation for the complexity,
quality and quantity of work that goes into a good editor.

gotta pat you guys on the back for your work...!
Reply all
Reply to author
Forward
0 new messages