-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsetup.js
More file actions
executable file
Β·46 lines (40 loc) Β· 1.65 KB
/
setup.js
File metadata and controls
executable file
Β·46 lines (40 loc) Β· 1.65 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#!/usr/bin/env node
const { execSync } = require('child_process');
const fs = require('fs');
const path = require('path');
console.log('π Setting up Logistics Management System API...\n');
// Check if .env exists
if (!fs.existsSync('.env')) {
console.log('π Creating .env file from template...');
fs.copyFileSync('env.example', '.env');
console.log('β
.env file created. Please update with your database credentials.\n');
} else {
console.log('β
.env file already exists.\n');
}
// Install dependencies
console.log('π¦ Installing dependencies...');
try {
execSync('npm install', { stdio: 'inherit' });
console.log('β
Dependencies installed successfully.\n');
} catch (error) {
console.error('β Error installing dependencies:', error.message);
process.exit(1);
}
// Generate Prisma client
console.log('π§ Generating Prisma client...');
try {
execSync('npx prisma generate', { stdio: 'inherit' });
console.log('β
Prisma client generated.\n');
} catch (error) {
console.error('β Error generating Prisma client:', error.message);
console.log('Please make sure your DATABASE_URL in .env is correct.\n');
}
console.log('π Setup completed!');
console.log('\nπ Next steps:');
console.log('1. Update your .env file with correct database credentials');
console.log('2. Make sure PostgreSQL is running');
console.log('3. Run: npm run db:push (to create database tables)');
console.log('4. Run: npm run db:seed (to add sample data)');
console.log('5. Run: npm run dev (to start development server)');
console.log('\nπ API will be available at: http://localhost:3000/api');
console.log('π Health check: http://localhost:3000/api/health');