質問編集履歴
1
build後のJavaScriptの追加
test
CHANGED
File without changes
|
test
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
### やりたいこと
|
2
2
|
|
3
|
-
Node.jsをType
|
3
|
+
Node.jsをTypeScriptで書いていており,request moduleで,サイトのbodyを取得したいです.
|
4
4
|
|
5
5
|
[https://www.sejuku.net/blog/73698#request](https://www.sejuku.net/blog/73698#request)
|
6
6
|
|
@@ -12,11 +12,11 @@
|
|
12
12
|
|
13
13
|
|
14
14
|
|
15
|
-
質問とは関係ありませんが,Type
|
15
|
+
質問とは関係ありませんが,TypeScriptで書いたNode.jsについて参考になるサイトを教えてくだされば幸いです.
|
16
16
|
|
17
17
|
###ソースコード
|
18
18
|
|
19
|
-
```t
|
19
|
+
```TypeScript
|
20
20
|
|
21
21
|
import * as http from "http";
|
22
22
|
|
@@ -62,6 +62,54 @@
|
|
62
62
|
|
63
63
|
```
|
64
64
|
|
65
|
+
```js
|
66
|
+
|
67
|
+
"use strict";
|
68
|
+
|
69
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
70
|
+
|
71
|
+
const request = require("request");
|
72
|
+
|
73
|
+
class Main {
|
74
|
+
|
75
|
+
constructor() {
|
76
|
+
|
77
|
+
console.log("fuck");
|
78
|
+
|
79
|
+
request(this.req_option_set, (error, body) => {
|
80
|
+
|
81
|
+
console.log(body);
|
82
|
+
|
83
|
+
console.log("you");
|
84
|
+
|
85
|
+
});
|
86
|
+
|
87
|
+
}
|
88
|
+
|
89
|
+
req_option_set() {
|
90
|
+
|
91
|
+
const options = {
|
92
|
+
|
93
|
+
url: 'https://www.sejuku.net/blog/',
|
94
|
+
|
95
|
+
method: 'GET'
|
96
|
+
|
97
|
+
};
|
98
|
+
|
99
|
+
console.log(typeof options);
|
100
|
+
|
101
|
+
return options;
|
102
|
+
|
103
|
+
}
|
104
|
+
|
105
|
+
}
|
106
|
+
|
107
|
+
const main = new Main();
|
108
|
+
|
109
|
+
//# sourceMappingURL=request_GET_POST.js.map
|
110
|
+
|
111
|
+
```
|
112
|
+
|
65
113
|
```Error
|
66
114
|
|
67
115
|
at Request.Main.request [as _callback] (C:\Users\User\Desktop\node\request_GET_POST\app.js:8:23)
|