These steps describe how you can deploy your app locally in production mode if you do not want to deploy your app online for free (see Deployment).
- MongoDB must be running locally on port 27017
Make sure you have all dependencies installed for the server and client (using
npm install
).
- Change into the root directory
cd group-00-web
- Set the environment variable
NODE_ENV
for the server:- macOS/Linux:
export NODE_ENV=production
(check withecho $NODE_ENV
) - Windows:
set NODE_ENV "production"
(check withecho %NODE_ENV%
)
- macOS/Linux:
- Set the environment variable
MONGODB_URI
for the server (change the database name "animals" according to your project):- macOS/Linux:
export MONGODB_URI=mongodb://localhost:27017/animalProductionDB
- Windows:
set MONGODB_URI "mongodb://localhost:27017/animalProductionDB"
- macOS/Linux:
- Set the environment variable
VUE_APP_API_ENDPOINT
for the client production build:- macOS/Linux:
export VUE_APP_API_ENDPOINT=http://localhost:3000/api
- Windows:
set VUE_APP_API_ENDPOINT "http://localhost:3000/api"
- macOS/Linux:
- Build the minified Vue.js production assets via
npm run build --prefix client
- Run the application with
npm run start --prefix server
β group-00-web git:(master) β npm run start --prefix server
3:03:38 PM web.1 | Express server listening on port 3000, in production mode
3:03:38 PM web.1 | Backend: http://localhost:3000/api/
3:03:38 PM web.1 | Frontend (production): http://localhost:3000/
3:03:38 PM web.1 | Connected to MongoDB with URI: mongodb://localhost:27017/animals-production