The development environment of the application is not yet containerized and it requires a few steps to get started. Make sure you have docker and docker-compose installed since the database is run inside a container.
- Clone the repository
git clone https://github.com/JuanitoSebastian/City-Bike-Journeys.git
- Configure details for the development database. A database instance for development can be launched using
docker-compose.dev.yml
at the root of the repository. You can change the password, user and name of the database by editing the .yml file. Start the development database by runningdocker-compose -f docker-compose.dev.yml up
in the root of the repository. - Create an
.env.development
file in the/backend
directory with the following structure:
/backend/.env.development:
POSTGRES_URI=postgresql://localhost:8000
POSTGRES_DB=postgres
POSTGRES_USER=postgres
POSTGRES_PW=example
PORT=3000
POSTGRES_URI
: PostgreSQL connection URI. Format: postgresql://host:portPOSTGRES_DB
: Name of Postgres databasePOSTGRES_USER
: Name of Postgres userPOSTGRES_PW
: Password for Postgres userPORT
: What port the back end should use
Make sure the details in the .env.development
file match the ones in the docker-compose.dev.yml
file.
- Create an
.env
file in the/frontend
directory with the following structure:
/frontend/.env
:
API_URL=http://localhost:3000
API_URL
: Url to the back end service.
- Open a terminal and run
npm install
in the/backend
directory. - In the same terminal run
npm run dev
in the/backend
directory. - Open another terminal and run
npm install
in the/frontend
directory. - In the same terminal run
npm run dev
in the/frontend
directory. - The back end should now be running on
localhost:3000
and the front end onlocalhost:8080
.
Make sure you have docker and docker-compose installed since the database is run inside a container.
- Clone the repository
git clone https://github.com/JuanitoSebastian/City-Bike-Journeys.git
- Configure details for the testing database. A database instance for testing can be launched using
docker-compose.dev.yml
at the root of the repository. You can change the password, user and name of the database by editing the .yml file. Start the testing database by runningdocker-compose -f docker-compose.dev.yml up
in the root of the repository. - Create an
.env.test
file in the/backend
directory with the following structure:
/backend/.env.test:
POSTGRES_URI=postgresql://localhost:8001
POSTGRES_DB=postgres
POSTGRES_USER=postgres
POSTGRES_PW=example
PORT=3000
POSTGRES_URI
: PostgreSQL connection URI. Format: postgresql://host:portPOSTGRES_DB
: Name of Postgres databasePOSTGRES_USER
: Name of Postgres userPOSTGRES_PW
: Password for Postgres userPORT
: What port the back end should use
Make sure the details in the .env.test
file match the ones in the docker-compose.dev.yml
file.
- Create an
.env
file in the/frontend
directory with the following structure:
/frontend/.env
:
API_URL=http://localhost:3000
API_URL
: Url to the back end service.
- Open a terminal and run
npm install
in the/backend
directory. - Run
npm install
in the/frontend
directory.
A testing environment is now ready. Read more on tests here.