Programando un "Google Drive" Casero
ayudanos a seguir creciendo.
Local setup (Linux & Windows)
Install dependencies:
cd server
npm i
cd ../client # ..\client on Windows
npm i
cd ..Run locally
Backend
Move to the server directory:
cd serverOpen sample.env and copy its content into a new file named .env, then set the correct value for HOME_CLOUD_STORAGE. Now start the server:
npm run devFrontend
Move to the client directory:
cd clientOpen sample.env and copy its content into a new file named .env, then set the correct value for REACT_APP_API_URL. Finally, start the development server:
npm startBackend will be running on port 5000 and frontend on port 3000 (if not already in use).
Docker (Linux)
First, set the correct value for HOME_CLOUD_STORAGE env variable:
export HOME_CLOUD_STORAGE="/home/user/example"Then create a .env file in ./client/ and set this value:
REACT_APP_API_URL="http://localhost:8081"Install dependencies:
docker-compose run express npm i
docker-compose run react npm iRun on Docker containers
docker-compose upBackend will be running on port 8081 and frontend on port 8080 (if not already in use).
Production Setup
Local (Linux & Windows)
Backend
Move to ./server/ and set the correct value for HOME_CLOUD_STORAGE in .env (see examples in sample.env), and then run npm start:
npm startFrontend
Move to ./client/ and create a file named .env.production, set the correct value for REACT_APP_API_URL (see examples in sample.env). Then, install serve globaly:
npm i -g serveBuild the app:
npm run build # Or yarn buildStart the server:
serve -s build -l 3000 # Or another port of your choiceDocker (Linux)
First, set the correct value for HOME_CLOUD_STORAGE env variable:
export HOME_CLOUD_STORAGE="/home/user/example"Then create a .env.production file in ./client/ and set the correct value for the API URL (your IP address and port 8081):
REACT_APP_API_URL="http://192.168.1.2:8081"Build images and run containers:
docker-compose -f docker-compose.yml -f docker-compose.prod.yml up
Comentarios
Publicar un comentario