Node.js express server, uploads file to Azure Blog Storage with message to Queues
npm install
.env.sample
and rename to .env.
file..env
:
npm start
http://localhost:3000
.Uploads a single file to blob store.
If messaging is enabled, the body of the form is part of the message, along with results of other operations such as create a blob.
Messaging is on by default, to disable, set app.config.messages.enabled to false
in server.js.
Response is a JSON object:
{
"filename": "5347493062294617-kb.1.json",
"originalname": "kb.1.json",
"size": 61135,
"path": "mycontainer-5/mydirectory-5/5347493062294617-kb.1.json",
"url": "myresource.file.core.windows.netmycontainer-5/mydirectory-5/5347493062294617-kb.1.json",
"messaging": true,
"instructions": {
"container": "myContainer-5",
"directory": "myDirectory-5"
},
"blobResults": {
"container": "mycontainer-5",
"name": "mydirectory-5/5347493062294617-kb.1.json",
"lastModified": "Wed, 31 Jul 2019 15:51:11 GMT",
"etag": "\"0x8D715CEE8FAAADE\"",
"contentLength": "0",
"requestId": "4900fd16-401e-0013-39b7-47e233000000",
"contentSettings": {
"contentMD5": "88r1GLLBsrZwgL5yKDnvSQ=="
}
},
"queueResults": {
"messageId": "8118b3f4-6dd5-46f0-8743-576879624b65",
"insertionTime": "Wed, 31 Jul 2019 15:51:11 GMT",
"expirationTime": "Wed, 07 Aug 2019 15:51:11 GMT",
"popReceipt": "AgAAAAMAAAAAAAAAiSPyxrdH1QE=",
"timeNextVisible": "Wed, 31 Jul 2019 15:51:11 GMT"
},
"result": {
"container": "mycontainer-5",
"name": "mydirectory-5/5347493062294617-kb.1.json",
"lastModified": "Wed, 31 Jul 2019 15:51:11 GMT",
"etag": "\"0x8D715CEE8FAAADE\"",
"contentLength": "0",
"requestId": "4900fd16-401e-0013-39b7-47e233000000",
"contentSettings": {
"contentMD5": "88r1GLLBsrZwgL5yKDnvSQ=="
}
}
}
Node.js express server receives file and streams to Azure Blob Storage. ExpressJS server doesn't need to have significant storage but it should have memory sufficient to handle streaming.