blob: 2b5aefb409045a1be98e5b3f39dadf203e329e37 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
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
|