123
This commit is contained in:
49
backend/package.json
Normal file
49
backend/package.json
Normal file
@@ -0,0 +1,49 @@
|
||||
{
|
||||
"name": "pg-admin-backend",
|
||||
"version": "1.0.0",
|
||||
"description": "PostgreSQL Admin Panel Backend API",
|
||||
"main": "src/index.js",
|
||||
"type": "module",
|
||||
"engines": {
|
||||
"node": ">=18.0.0",
|
||||
"npm": ">=9.0.0"
|
||||
},
|
||||
"scripts": {
|
||||
"start": "node src/index.js",
|
||||
"dev": "nodemon src/index.js",
|
||||
"test": "jest --coverage",
|
||||
"test:watch": "jest --watch",
|
||||
"lint": "eslint src --fix",
|
||||
"format": "prettier --write 'src/**/*.js'"
|
||||
},
|
||||
"keywords": [
|
||||
"postgresql",
|
||||
"admin",
|
||||
"database",
|
||||
"management"
|
||||
],
|
||||
"author": "",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"express": "^4.18.2",
|
||||
"express-async-errors": "^3.1.1",
|
||||
"pg": "^8.9.0",
|
||||
"dotenv": "^16.0.3",
|
||||
"bcryptjs": "^2.4.3",
|
||||
"jsonwebtoken": "^9.0.0",
|
||||
"cors": "^2.8.5",
|
||||
"helmet": "^7.0.0",
|
||||
"express-rate-limit": "^6.7.0",
|
||||
"joi": "^17.9.0",
|
||||
"winston": "^3.8.2",
|
||||
"axios": "^1.4.0",
|
||||
"uuid": "^9.0.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"nodemon": "^3.0.1",
|
||||
"eslint": "^8.54.0",
|
||||
"prettier": "^3.1.0",
|
||||
"jest": "^29.7.0",
|
||||
"supertest": "^6.3.3"
|
||||
}
|
||||
}
|
||||
36
backend/src/index.js
Normal file
36
backend/src/index.js
Normal file
@@ -0,0 +1,36 @@
|
||||
import express from 'express';
|
||||
import cors from 'cors';
|
||||
import helmet from 'helmet';
|
||||
import dotenv from 'dotenv';
|
||||
|
||||
dotenv.config();
|
||||
|
||||
const app = express();
|
||||
const PORT = process.env.PORT || 3000;
|
||||
|
||||
// Middleware
|
||||
app.use(helmet());
|
||||
app.use(cors());
|
||||
app.use(express.json());
|
||||
|
||||
// Health check
|
||||
app.get('/api/health', (req, res) => {
|
||||
res.json({ status: 'OK', timestamp: new Date().toISOString() });
|
||||
});
|
||||
|
||||
// Basic info
|
||||
app.get('/api', (req, res) => {
|
||||
res.json({
|
||||
name: 'PostgreSQL Admin API',
|
||||
version: '1.0.0',
|
||||
status: 'running'
|
||||
});
|
||||
});
|
||||
|
||||
// Start server
|
||||
app.listen(PORT, () => {
|
||||
console.log(`✅ Backend server running on port ${PORT}`);
|
||||
console.log(`Environment: ${process.env.NODE_ENV || 'development'}`);
|
||||
});
|
||||
|
||||
export default app;
|
||||
Reference in New Issue
Block a user