Please use the Apache issue tracking system for new NetBeans issues ( !!
Bug 254424 - Code templates for Node.js
Code templates for Node.js
Product: javascript
Classification: Unclassified
Component: Node.js
PC Windows 7
: P2 (vote)
: 8.1
Assigned To: Petr Pisl
Depends on:
  Show dependency treegraph
Reported: 2015-08-17 10:27 UTC by Geertjan Wielenga
Modified: 2015-08-24 08:44 UTC (History)
2 users (show)

See Also:


Note You need to log in before you can comment on or make changes to this bug.
Description Geertjan Wielenga 2015-08-17 10:27:59 UTC
Create some simple code templates for Node.js. For example, when I type 'nodehttp' in the JavaScript editor and press Tab, I'd like to see this:

var http = require('http');
http.createServer(function (req, res) {
  res.writeHead(200, {'Content-Type': 'text/plain'});
  res.end('Hello World\n');
}).listen(1337, '');
console.log('Server running at');

When I type 'nodenet', in the JS editor, and press Tab, I'd like to see this:

var net = require('net');

var server = net.createServer(function (socket) {
  socket.write('Echo server\r\n');

server.listen(1337, '');
Comment 1 Antonin Nebuzelsky 2015-08-20 15:42:10 UTC
For these code snippets it seems to me that they would be useful rather as sample projects.

IMO if we want to have code templates for Node.js apps, we should have a comprehensive list of most frequently used boiler plate code.
Comment 2 Petr Pisl 2015-08-24 08:44:29 UTC
I agree with Tonda. On the other hand I have created the files needed to add the templates to the editor. Requested templates were added as samples.

By use of this website, you agree to the NetBeans Policies and Terms of Use. © 2014, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo