Automated Action 84cb69bf10 Rewrite authentication service from FastAPI/Python to Node.js/Express
- Replace FastAPI with Express.js framework
- Replace SQLAlchemy with Sequelize ORM
- Replace Alembic with Sequelize migrations
- Implement bcryptjs for password hashing
- Add JWT authentication with jsonwebtoken
- Create Express routes and controllers
- Add input validation with express-validator
- Implement rate limiting and security headers
- Configure CORS for all origins
- Add environment-based configuration
- Update README with Node.js setup instructions

Environment variables required:
- JWT_SECRET: JWT secret key for token signing
- NODE_ENV: Environment (development/production)
- PORT: Server port (default: 3000)
- JWT_EXPIRES_IN: Token expiration time (default: 24h)
2025-06-27 09:28:13 +00:00

22 lines
534 B
JavaScript

const { Sequelize } = require('sequelize');
const path = require('path');
const fs = require('fs');
const dbDir = '/app/storage/db';
if (!fs.existsSync(dbDir)) {
fs.mkdirSync(dbDir, { recursive: true });
}
const sequelize = new Sequelize({
dialect: 'sqlite',
storage: path.join(dbDir, 'db.sqlite'),
logging: process.env.NODE_ENV === 'development' ? console.log : false,
define: {
timestamps: true,
underscored: true,
createdAt: 'created_at',
updatedAt: 'updated_at'
}
});
module.exports = { sequelize };