2015-07-13 06:22:46 -04:00
|
|
|
snippet #!
|
|
|
|
#!/usr/bin/env node
|
2014-09-27 11:32:18 -04:00
|
|
|
# module exports
|
|
|
|
snippet ex
|
|
|
|
module.exports = ${1};
|
|
|
|
# require
|
|
|
|
snippet re
|
2016-12-27 09:46:49 -05:00
|
|
|
${1:const} ${2} = require('${3:module_name}');
|
2014-09-27 11:32:18 -04:00
|
|
|
# EventEmitter
|
|
|
|
snippet on
|
|
|
|
on('${1:event_name}', function(${2:stream}) {
|
|
|
|
${3}
|
|
|
|
});
|
|
|
|
snippet emit
|
|
|
|
emit('${1:event_name}', ${2:args});
|
|
|
|
snippet once
|
|
|
|
once('${1:event_name}', function(${2:stream}) {
|
|
|
|
${3}
|
|
|
|
});
|
|
|
|
# http. User js function snippet as handler
|
|
|
|
snippet http
|
|
|
|
http.createServer(${1:handler}).listen(${2:port_number});
|
|
|
|
# net
|
|
|
|
snippet net
|
|
|
|
net.createServer(function(${1:socket}){
|
|
|
|
${1}.on('data', function('data'){
|
|
|
|
${2}
|
|
|
|
]});
|
|
|
|
${1}.on('end', function(){
|
|
|
|
${3}
|
|
|
|
});
|
|
|
|
}).listen(${4:8124});
|
|
|
|
# Stream snippets
|
|
|
|
snippet pipe
|
|
|
|
pipe(${1:stream})${2}
|
|
|
|
# Express snippets
|
|
|
|
snippet eget
|
|
|
|
${1:app}.get('${2:route}', ${3:handler});
|
|
|
|
snippet epost
|
|
|
|
${1:app}.post('${2:route}', ${3:handler});
|
|
|
|
snippet eput
|
|
|
|
${1:app}.put('${2:route}', ${3:handler});
|
|
|
|
snippet edel
|
|
|
|
${1:app}.delete('${2:route}', ${3:handler});
|
|
|
|
# process snippets
|
|
|
|
snippet stdin
|
|
|
|
process.stdin
|
|
|
|
snippet stdout
|
|
|
|
process.stdout
|
|
|
|
snippet stderr
|
|
|
|
process.stderr
|