質問編集履歴
2
修正しました
title
CHANGED
File without changes
|
body
CHANGED
@@ -75,7 +75,7 @@
|
|
75
75
|
|
76
76
|
// アップロード
|
77
77
|
const options = {
|
78
|
-
url: 'https://object-storage.tyo2.conoha.io/v1/xxxxxxxxxxx/
|
78
|
+
url: 'https://object-storage.tyo2.conoha.io/v1/xxxxxxxxxxx/コンテナ',
|
79
79
|
method: 'POST',
|
80
80
|
headers: headers,
|
81
81
|
formData: file
|
1
少し修正しました。
title
CHANGED
File without changes
|
body
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
### 前提・実現したいこと
|
2
2
|
|
3
|
-
|
3
|
+
node.jsでHTTPメソッドを使って、conohaオブジェクトストレージに画像をアップロードさせたいです。
|
4
|
+
今はクライアントからmulterで画像データを受け取り、HTTPメソッドであるrequestでアップロードする流れにしています。
|
4
5
|
|
5
6
|
以下参考にしたサイト
|
6
7
|
|
@@ -94,5 +95,25 @@
|
|
94
95
|
})
|
95
96
|
});
|
96
97
|
|
97
|
-
|
98
|
+
```
|
99
|
+
### 試したこと
|
100
|
+
requestのgetメソッドでオブジェクトストレージへの接続は確認できました。
|
101
|
+
```node
|
102
|
+
// オブジェクトストレージへの接続
|
103
|
+
const headers = {
|
104
|
+
'X-Auth-Token': token,
|
105
|
+
'Accept': 'application/json'
|
106
|
+
};
|
107
|
+
|
108
|
+
const options = {
|
109
|
+
url: 'https://object-storage.tyo2.conoha.io/v1/xxxxxxxxxx/コンテナ',
|
110
|
+
headers: headers
|
111
|
+
}
|
112
|
+
|
113
|
+
httpRequest.get(options, function (error, result, body) {
|
114
|
+
console.log(`resultStatus: ${result.statusCode}`)
|
115
|
+
})
|
116
|
+
```
|
117
|
+
```
|
118
|
+
resultStatus: 200
|
98
119
|
```
|