aboutsummaryrefslogtreecommitdiff
path: root/vim/bundle/vim-snippets/snippets/javascript/javascript.node.snippets
diff options
context:
space:
mode:
authorKarel Kočí <cynerd@email.cz>2016-06-30 16:03:25 +0200
committerKarel Kočí <cynerd@email.cz>2016-06-30 16:03:25 +0200
commite573b3020c032400eed60b649a2cbf55266e6bb0 (patch)
tree8f572394ac8433529c7a8e70d160a2fbe8268b4e /vim/bundle/vim-snippets/snippets/javascript/javascript.node.snippets
parentb8c667bd64b3edd38d56c63c5bd1db53a23b4499 (diff)
downloadmyconfigs-e573b3020c032400eed60b649a2cbf55266e6bb0.tar.gz
myconfigs-e573b3020c032400eed60b649a2cbf55266e6bb0.tar.bz2
myconfigs-e573b3020c032400eed60b649a2cbf55266e6bb0.zip
Add current configurations from old repository
Diffstat (limited to 'vim/bundle/vim-snippets/snippets/javascript/javascript.node.snippets')
-rw-r--r--vim/bundle/vim-snippets/snippets/javascript/javascript.node.snippets51
1 files changed, 51 insertions, 0 deletions
diff --git a/vim/bundle/vim-snippets/snippets/javascript/javascript.node.snippets b/vim/bundle/vim-snippets/snippets/javascript/javascript.node.snippets
new file mode 100644
index 0000000..2b5aefb
--- /dev/null
+++ b/vim/bundle/vim-snippets/snippets/javascript/javascript.node.snippets
@@ -0,0 +1,51 @@
+snippet #!
+ #!/usr/bin/env node
+# module exports
+snippet ex
+ module.exports = ${1};
+# require
+snippet re
+ ${1:var} ${2} = require('${3:module_name}');
+# 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