aboutsummaryrefslogtreecommitdiff
path: root/vim/bundle/vim-snippets/UltiSnips/javascript-node.snippets
blob: 7a14deeb9bd7a26b91306932c79c89887cee54fb (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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
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"
http.createServer(${1}).listen(${2});
endsnippet

snippet ncs "net.createServer"
net.createServer(function(${1:socket}){
	${1}.on('data', function(${3:data}){
		${4}
	});
	${1}.on('end', function(){
		${5}
	});
}).listen(${6:8124});
endsnippet

snippet pipe "pipe"
pipe(${1:stream})${2}
endsnippet

# Express snippets

snippet eget "express GET"
${1:app}.get('${2}', ${3});
endsnippet

snippet epost "express POST"
${1:app}.post('${2}', ${3});
endsnippet

snippet eput "express PUT"
${1:app}.put('${2}', ${3});
endsnippet

snippet edelete "express DELETE"
${1:app}.delete('${2}', ${3});
endsnippet

# process snippets

snippet stdout "stdout"
process.stdout
endsnippet

snippet stdin "stdin"
process.stdin
endsnippet

snippet stderr "stderr"
process.stderr
endsnippet