This project is an api (similar to Ergast) for getting formula one data in a restful representation. I made this project to learn and use Spring, REST & JPA/Hibernate and to test on different relational databases.
The following topics are covered:
- A relational database that holds data about Formula One.
- A REST service that exposes the data in the database.
- Rest documentation with swagger
In MySQL Workbench:
- Click on Server tab
- Click on Data import menu
- Select import from Self-Contained file and navigate to the MySQL sql script
- Press Start import
With command line:
mysql -u username -p password f1db < /path/to/f1dbmysql20150323.sql
In pgAdmin3:
- select the required target schema in object tree
- Click on Plugins/PSQL Console
- Write:
\i /path/to/yourfile.sql
- Press enter
With command line:
psql -U postgres -d f1db -f /path/to/f1dbpostgresql20150323.sql
Adjust application.properties to let it work on your local setup.
examples:
To run this project:
Navigate to main
with command line tool
mvn clean install
Than navigate to main/rest
with command line tool to run it
mvn clean jetty:run -P dev
Then point your browser to the Swagger api documentation link available at: http://localhost:8080/swagger-ui.html
It will provide an user interface which visualizes an applications JSON api.
Note: still XML representation is also supported in my REST webservice but not available in Swagger because it only supports JSON.
- Enable and configure travis-ci for running builds/tests
- A lot more api endpoints that need to be added
- Thanks to Ergast for the usage and keeping the database up to date
- Thanks to Spring for the useful guides
- Thanks to pkainulainen for the useful tutorials and examples
- Thanks to lanyrd for his mysql to postgresql script converter