52 lines
791 B
Plaintext
52 lines
791 B
Plaintext
priority -50
|
|
|
|
snippet #! "shebang"
|
|
#!/usr/bin/env node
|
|
endsnippet
|
|
|
|
snippet vreq "assign a CommonJS-style module to a var"
|
|
var ${0:${1/(.+\/)*(\w+)(-|\b|$)(\..+$)?/\u$2/g}} = require('${1}');
|
|
endsnippet
|
|
|
|
snippet ex "module.exports"
|
|
module.exports = ${1};
|
|
endsnippet
|
|
|
|
snippet hcs
|
|
http.createServer(${1}).listen(${2});
|
|
endsnippet
|
|
|
|
snippet ncs
|
|
net.createServer(function(${1:socket}){
|
|
${1}.on('data', function(${3:data}){
|
|
${4}
|
|
});
|
|
${1}.on('end', function(){
|
|
${5}
|
|
});
|
|
}).listen(${6:8124});
|
|
endsnippet
|
|
|
|
snippet pipe
|
|
pipe(${1:stream})${2}
|
|
endsnippet
|
|
|
|
# Express snippets
|
|
|
|
snippet eget
|
|
${1:app}.get('${2}', ${3});
|
|
endsnippet
|
|
|
|
snippet epost
|
|
${1:app}.post('${2}', ${3});
|
|
endsnippet
|
|
|
|
snippet eput
|
|
${1:app}.put('${2}', ${3});
|
|
endsnippet
|
|
|
|
snippet edelete
|
|
${1:app}.delete('${2}', ${3});
|
|
endsnippet
|
|
|