symphonicc / multer-azure-blob-storage

ES6 & Typescript friendly multer storage engine for Azure's blob storage.
MIT License
19 stars 25 forks source link

Cannot find namespace 'Express' #3

Closed SharpFu closed 6 years ago

SharpFu commented 6 years ago

the error is "Cannot find namespace 'Express' " ,bug I do not fond Express in package.json。why

Sliverb commented 6 years ago

Interesting. I will look into this. Thanks :)

SharpFu commented 6 years ago

i found the file in lib/MulterAzureStorage.d.ts need import Express from express,please check it. and I hava an other question about use azure blob.that is flow: when i use "PUT" mthods and SAS services to upload a file, such as : this.http.put('https://xxx.blob.core.chinacloudapi.cn/msl-develop-files/%E9%82%AE%E7%AE%B1.png?sig=xxxxxxxx&se=2018-04-19T05%3A42%3A45Z&sv=2015-07-08&sp=rc&sr=b', fileInfo).subscribe(data=>{ }); and i get the error is "An HTTP header that's mandatory for this request is not specified" ,I want to know that there is need to add Authorization to the headers when use SAS services?

Sliverb commented 6 years ago

Thanks for researching this for me. I will try and get the fix out this week

Sliverb commented 6 years ago

Hi SharpFu, I am unable to reproduce this error. Express is only referenced in the lib, so I didn't import the whole lib. The ref is imported by @types/multer

Some questions to help us get this fixed

What I am assuming its a dependency issue. I have pushed an update that now includes important types as required dependencies.

Thanks again for filing this issue

Sliverb commented 6 years ago

As for your second question on uploading using REST. I believe you do need to set a few headers This is one from this site: http://markheath.net/post/upload-azure-blob-storage-sas

var client = new HttpClient();
var content = new StringContent("Some content");
content.Headers.Add("x-ms-blob-type", "BlockBlob");
var response = await client.PutAsync(sas, content);
response.EnsureSuccessStatusCode();

The blob storage blob page details the other headers you will need to set (Authorization being super super important): https://docs.microsoft.com/en-us/rest/api/storageservices/put-blob