Skip to content

stakeordie/cloud-uploader

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Azure Upload Service

A lightweight, standalone Node.js service for handling Azure Blob Storage uploads with detailed logging and diagnostics.

Features

  • Health Check: GET /health - Service status
  • Azure Test: GET /test-azure - Test Azure connectivity and upload
  • Base64 Upload: POST /upload-base64 - Upload base64 encoded data
  • File Upload: POST /upload-file - Upload multipart files
  • Detailed Logging: Comprehensive Azure SDK response logging
  • Built for Railway: Ready-to-deploy with railway.json

Quick Start

Local Development

# Clone the repo
git clone <your-repo-url>
cd azure-upload-service

# Install dependencies
npm install

# Configure environment
cp .env.example .env
# Edit .env with your Azure credentials

# Start service
npm start

# Development with auto-reload
npm run dev

Railway Deployment

  1. Connect your GitHub repo to Railway
  2. Set environment variables in Railway dashboard:
    • AZURE_STORAGE_ACCOUNT_NAME
    • AZURE_STORAGE_ACCOUNT_KEY
    • AZURE_STORAGE_CONTAINER
  3. Deploy automatically via Git push

Environment Variables

Variable Description Example
AZURE_STORAGE_ACCOUNT_NAME Azure storage account name mystorageaccount
AZURE_STORAGE_ACCOUNT_KEY Azure storage account key your-64-char-key==
AZURE_STORAGE_CONTAINER Azure container name uploads
API_KEY API key for authentication your-secure-api-key
PORT Service port 3000

API Usage

Test Azure Connectivity

curl -H "X-API-Key: your-api-key" http://localhost:3000/test-azure

Upload Base64 Data

curl -X POST http://localhost:3000/upload-base64 \
  -H "Content-Type: application/json" \
  -H "X-API-Key: your-api-key" \
  -d '{
    "filename": "test.png",
    "base64Data": "iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mP8/x8AAwMCAO+ip1sAAAAASUVORK5CYII=",
    "contentType": "image/png"
  }'

Upload File

curl -X POST http://localhost:3000/upload-file \
  -H "X-API-Key: your-api-key" \
  -F "file=@test.png" \
  -F "filename=test.png"

Authentication

All upload and test endpoints require API key authentication. Provide the API key via:

  • X-API-Key header: X-API-Key: your-api-key
  • Authorization header: Authorization: Bearer your-api-key

The /health endpoint is public and doesn't require authentication.

Deployment

Deploy to Railway using the included railway.json configuration:

railway login
railway up

Purpose

This service helps isolate Azure upload issues by:

  1. Testing the same Azure SDK in a clean environment
  2. Providing detailed response logging
  3. Eliminating potential interference from the main application
  4. Allowing network-level debugging of Azure connectivity

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published