Please use the Apache issue tracking system for new NetBeans issues (https://issues.apache.org/jira/projects/NETBEANS0/issues) !!
Bug 254424 - Code templates for Node.js
Code templates for Node.js
Status: RESOLVED FIXED
Product: javascript
Classification: Unclassified
Component: Node.js
8.1
PC Windows 7
: P2 (vote)
: 8.1
Assigned To: Petr Pisl
issues@javascript
:
Depends on:
Blocks:
  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:
Issue Type: ENHANCEMENT
:


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.


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