1
2
| [~/.../chapter20-nodejs/juanIrache-20_3_public_space(master)]$ pwd -P
/Users/casiano/local/src/javascript/eloquent-javascript-3/juanIrache-solutions/20_3_public_space
|
1
| [~/.../juanIrache-solutions/20_3_public_space(master)]$ cat gulpfile.js
|
1
2
3
4
5
6
7
8
| [~/.../juanIrache-solutions/20_3_public_space(master)]$ gulp server
[13:32:53] Using gulpfile ~/local/src/javascript/eloquent-javascript-3/juanIrache-solutions/20_3_public_space/gulpfile.js
[13:32:53] Starting 'server'...
[nodemon] 1.11.0
[nodemon] to restart at any time, enter `rs`
[nodemon] watching: *.*
[nodemon] starting `node server.js`
hello world!
|
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
| [~/.../chapter20-nodejs/juanIrache-20_3_public_space(master)]$ gulp cget
[13:35:11] Using gulpfile ~/local/src/javascript/eloquent-javascript-3/juanIrache-solutions/20_3_public_space/gulpfile.js
[13:35:11] Starting 'cget'...
stdout: {
"name": "20_3_public_space",
"version": "1.0.0",
"description": "Solutions for Chapter 20 of EJS book: https://eloquentjavascript.net/20_node.html by Juan Irache",
"main": "code.js",
"scripts": {
"test": "nodemon server.js",
"start": "node server.js"
},
"keywords": [],
"author": "Casiano Rodriguez-Leon <casiano.rodriguez.leon@gmail.com> (https://github.com/crguezl)",
"license": "ISC",
"dependencies": {
"mime": "^2.4.4"
},
"devDependencies": {
"gulp": "^4.0.2"
}
}
stderr: % Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0* Trying ::1...
* TCP_NODELAY set
* Connected to localhost (::1) port 8000 (#0)
> GET /package.json HTTP/1.1
> Host: localhost:8000
> User-Agent: curl/7.54.0
> Accept: */*
>
< HTTP/1.1 200 OK
< Access-Control-Allow-Origin: *
< Access-Control-Allow-Methods: POST, PUT, GET, OPTIONS, DELETE, MKCOL
< Content-Type: application/json
< Date: Thu, 31 Oct 2019 13:35:12 GMT
< Connection: keep-alive
< Transfer-Encoding: chunked
<
{ [519 bytes data]
100 512 0 512 0 0 9662 0 --:--:-- --:--:-- --:--:-- 9846
* Connection #0 to host localhost left intact
[13:35:12] Finished 'cget' after 97 ms
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
| var gulp = require("gulp");
var shell = require("gulp-shell");
gulp.task("pre-install", shell.task([
"npm i -g gulp static-server",
"npm install -g nodemon",
"npm install -g gulp-shell"
]));
gulp.task("serve", shell.task("nodemon server.js"));
gulp.task("lint", shell.task("jshint *.js **/*.js"));
gulp.task("get", shell.task("curl -v http://localhost:8000/file.txt"));
gulp.task("put", shell.task("curl -v -X PUT -d 'Bye world!' http://localhost:8000/file.txt"));
|