teratail header banner
teratail header banner
質問するログイン新規登録

質問編集履歴

2

修正しました

2021/10/17 14:52

投稿

naoya7081111
naoya7081111

スコア1

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/photo',
78
+ url: 'https://object-storage.tyo2.conoha.io/v1/xxxxxxxxxxx/コンテナ',
79
79
  method: 'POST',
80
80
  headers: headers,
81
81
  formData: file

1

少し修正しました。

2021/10/17 14:52

投稿

naoya7081111
naoya7081111

スコア1

title CHANGED
File without changes
body CHANGED
@@ -1,6 +1,7 @@
1
1
  ### 前提・実現したいこと
2
2
 
3
- クライアントから送られた画像データをNode.jsのmulter受け取りrequestでconohaオブジェクトストレージにアップロードさせたいです。
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
  ```