
Security News
Crates.io Users Targeted by Phishing Emails
The Rust Security Response WG is warning of phishing emails from rustfoundation.dev targeting crates.io users.
@digoch/ata-bridge-backend
Advanced tools
A robust backend API server for the Data Bridge application that handles database connections, file parsing, and external function calls.
Install dependencies:
npm install
Configure environment:
cp .env.example .env
# Edit .env with your configuration
Start the server:
# Development mode
npm run dev
# Production mode
npm start
Verify installation:
curl http://localhost:3001/health
/health
- Server health status/api/db-connector
- Main database operations/api/db-connector/credentials
- Store database credentials (testing)/api/parse-file/upload
- Upload file/api/parse-file
- Parse uploaded file/api/parse-file/excel
- Parse Excel file specifically/api/parse-file/csv
- Parse CSV file specifically/api/parse-file/cleanup
- Clean up old files/api/external-function
- Execute external function/api/external-function/register
- Register new external function/api/external-function/list
- List all functions/api/external-function/:id
- Get function details/api/external-function/:id
- Update function/api/external-function/:id
- Delete function/api/external-function/:id/test
- Test function# Server Configuration
NODE_ENV=development
PORT=3001
# Database Examples
POSTGRES_HOST=localhost
POSTGRES_PORT=5432
POSTGRES_DB=databridge
POSTGRES_USER=your_username
POSTGRES_PASSWORD=your_password
MYSQL_HOST=localhost
MYSQL_PORT=3306
MYSQL_DB=databridge
MYSQL_USER=your_username
MYSQL_PASSWORD=your_password
# File Upload
UPLOAD_DIR=./uploads
MAX_FILE_SIZE=50MB
# External API
EXTERNAL_API_TIMEOUT=30000
EXTERNAL_API_RETRIES=3
# Security
RATE_LIMIT_WINDOW_MS=900000
RATE_LIMIT_MAX_REQUESTS=100
// List tables
const response = await fetch('/api/db-connector', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({
credentialId: 'your-credential-id',
action: 'list_tables'
})
});
// Get table columns
const response = await fetch('/api/db-connector', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({
credentialId: 'your-credential-id',
action: 'get_columns',
payload: { tableName: 'users' }
})
});
// Insert data
const response = await fetch('/api/db-connector', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({
credentialId: 'your-credential-id',
action: 'insert_data',
payload: {
tableName: 'users',
data: [
{ name: 'John', email: 'john@example.com' },
{ name: 'Jane', email: 'jane@example.com' }
],
columnMappings: {
name: 'A',
email: 'B'
}
}
})
});
// Upload file
const formData = new FormData();
formData.append('file', fileInput.files[0]);
const uploadResponse = await fetch('/api/parse-file/upload', {
method: 'POST',
body: formData
});
// Parse file
const parseResponse = await fetch('/api/parse-file', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({
file_url: uploadResponse.file_url,
getFullData: false // true to get all data
})
});
// Register external function
const registerResponse = await fetch('/api/external-function/register', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({
id: 'custom-processor',
name: 'Custom Data Processor',
description: 'Processes data with custom logic',
endpoint: 'https://your-api.com/process',
method: 'POST',
timeout: 30000
})
});
// Execute external function
const executeResponse = await fetch('/api/external-function', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({
externalFunctionId: 'custom-processor',
payload: {
tableName: 'users',
data: [...],
columnMappings: {...}
}
})
});
backend/
├── middleware/ # Custom middleware
│ ├── errorHandler.js # Global error handling
│ └── logger.js # Request/response logging
├── routes/ # API route handlers
│ ├── db-connector.js # Database operations
│ ├── parse-file.js # File parsing
│ └── external-function.js # External function calls
├── services/ # Business logic
│ └── databaseFactory.js # Database connection factory
├── uploads/ # File upload directory
├── .env.example # Environment template
├── package.json # Dependencies and scripts
└── server.js # Main application entry point
The server includes comprehensive logging:
Check console output for detailed information about all operations.
All endpoints return consistent error responses:
{
"error": {
"message": "Error description",
"status": 400,
"timestamp": "2024-01-01T00:00:00.000Z",
"details": ["Additional error details"]
}
}
This backend is designed to work with your Data Bridge frontend application. Make sure to:
VITE_API_URL
in your frontend environmentFor issues or questions, check the console logs for detailed error information.
FAQs
Backend API server for Data Bridge application
We found that @digoch/ata-bridge-backend demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
The Rust Security Response WG is warning of phishing emails from rustfoundation.dev targeting crates.io users.
Product
Socket now lets you customize pull request alert headers, helping security teams share clear guidance right in PRs to speed reviews and reduce back-and-forth.
Product
Socket's Rust support is moving to Beta: all users can scan Cargo projects and generate SBOMs, including Cargo.toml-only crates, with Rust-aware supply chain checks.