-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathInfo.txt
51 lines (36 loc) · 956 Bytes
/
Info.txt
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
47
48
49
50
51
npm create vite@latest
fork repository
git clone repository url
1. cd backend / cd frontend
2. npm i
cd ../
3. npm run dev
Proxy Setup for Development:
To simplify API calls and avoid CORS issues during development,
you can set up a proxy in vite.config.js:
backend: npm i express cors dotenv body-parser
npm i --save-dev nodemon
express: Web framework for Node.js.
cors: Middleware to enable CORS.
body-parser: Middleware to parse request bodies.
dotenv: For environment variable management.
nodemon: Development tool for automatically restarting the server on changes.
setup SQL Database
npm i mysql2/pg
.env
Setup Scripts in package.json:
json
Copy code
// backend/package.json
{
"scripts": {
"start": "node server.js",
"dev": "nodemon server.js"
}
}
Serve Frontend from Backend
1. Build Frontend:
cd your-project/frontend
npm run build
This generates static files in the dist folder.
2. Serve Static Files in Express: