This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 254424 - Code templates for Node.js
Summary: Code templates for Node.js
Status: RESOLVED FIXED
Alias: None
Product: javascript
Classification: Unclassified
Component: Node.js (show other bugs)
Version: 8.1
Hardware: PC Windows 7
: P2 normal (vote)
Assignee: Petr Pisl
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-08-17 10:27 UTC by Geertjan Wielenga
Modified: 2015-08-24 08:44 UTC (History)
2 users (show)

See Also:
Issue Type: ENHANCEMENT
Exception Reporter:


Attachments

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, '127.0.0.1');
console.log('Server running at http://127.0.0.1:1337/');

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');
  socket.pipe(socket);
});

server.listen(1337, '127.0.0.1');
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.