Skip to content

leolab1337/dev-academy-2023-exercise

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Helsinki city bike app (Dev Academy pre-assignment)

This is the pre-assignment for the Solita Dev Academy Finland 2023.

Getting started

1. Create a database

In the backend folder, you will find the DBScript.sql file.

Open it and copy all of its content.

Open your SQL database in the terminal and paste the content of the file.

When it is done, you will have a database.

2. Configure .env file

In the root of the frontend and backend folders, you will find .env files Open them and change the values if needed:

Field name Description
DATABASE_DIALECT mariadb
DATABASE_NAME name of your database, helsinki_city_bike is default
DATABASE_USER username of your SQL database
DATABASE_PASSWORD password for the username
SERVER_HOST hostname, localhost is default
SERVER_PORT port number, where you wish to run API , 8080 is default
CORS_ORIGIN base URL of your application = where your application (UI) is running, http://localhost:3000 is default
REACT_APP_SERVER_HOST hostname should be the same as SERVER_HOST, localhost is default
REACT_APP_SERVER_PORT port number should be the same as SERVER_PORT
REACT_APP_SERVER_PORT http://localhost:8080 isdefault

3. Install npm packages

Go into the frontend and backend folders one by one and write the following command in the console:

npm i

4. Data

There are two variants(4.1 or 4.2):

4.1.1 Add data to the data folders:

Download the following files:

https://dev.hsl.fi/citybikes/od-trips-2021/2021-05.csv
https://dev.hsl.fi/citybikes/od-trips-2021/2021-06.csv
https://dev.hsl.fi/citybikes/od-trips-2021/2021-07.csv

Put them in the following location:

backend/data/csv/journeys

Important! Delete addDatahere file.

Note: backend/data/csv/bicycle-stations-dataset has already file inside, and it accepts another files with same format if it is desired (source: https://opendata.arcgis.com/datasets/726277c507ef4914b0aec3cbcfcbfafc_0.csv)

4.1.2 Activate the converter:

  • Go to -> backend/server.js file and uncomment the 32nd row
  • Write the following command in the console: npm run start
  • //todo make another separeted logic for the converter
  • Wait about 3 hours for the results to be converted. On success, comment back the 32nd line and reload the application.

5. Backend usage

To run backend go the backend folder and write command: npm run start

By default it will be run on the http://localhost:8080/

Then , in your usage will be different paths, that are described in the swagger http://localhost:8080/api-docs/

And here are er diagrams , for better understanding with which format the api works

6. Frontend

To run the frontendt, go to the frontend folder and write the following command in the console: npm run start

By default it will be run on the http://localhost:3000/ port

How frontend looks at the moment:

About

An exercise for Solita Dev Academy 2023

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 96.7%
  • CSS 2.4%
  • HTML 0.9%