NUS Tour
Before you begin, ensure you have met the following requirements:
- Node.js installed on your machine or set up a Dev Container in Visual Studio Code.
Environment variables are required to configure the backend and frontend. Sample files are provided for your convenience.
# Database Configuration
DB_HOST=<host>
DB_PORT=<port>
DB_NAME=<database>
DB_USER=<user>
DB_PASSWORD=<password>
# CORS Configuration
CORS_ORIGIN=http://localhost:5173
CORS_CREDENTIALS=true
CORS_METHODS=GET,POST,PUT,DELETE
CORS_HEADERS=Content-Type,Authorization
VITE_API_BASE_URL=http://localhost:3000
To set up and run the web application locally, follow these steps:
- Set Up Environment Variables: Ensure
.env
files are correctly configured in both the backend and frontend directories. - Navigate to the project directory:
cd nus-tour
- Install dependencies:
npm run install:all
- Start the application:
npm run start:dev:all
The application will be running at:
- Frontend: http://localhost:5173
- Backend: http://localhost:3000
If you'd like to run the backend inside a Docker container, follow these steps:
- Build the Docker Image:
- Unix-like:
docker build -t nus-tour-backend -f ./backend/Dockerfile ./backend
- Windows:
docker build -t nus-tour-backend -f .\backend\Dockerfile .\backend
- Unix-like:
- Run the Docker Container:
- Unix-like:
docker run -it -p 0.0.0.0:3000:3000 --env-file ./backend/.env nus-tour-backend
- Windows:
docker run -it -p 0.0.0.0:3000:3000 --env-file .\backend\.env nus-tour-backend
- Unix-like:
The backend will be running at: http://localhost:3000