The main idea from this project is put together some concepts like RESTFull, authentication by Json Web Token and separate the development from the backend and frontend.
This project is in Java and is a alternative to SpringBoot Kotlin Blog where the frontend is Vue Blog Project. Obs: This project is based to communicate with Vue-auth.
A special thanks to @bfwg your code help a lot. See: Springboot Jwt Starter.
- PostgreSQL run as database of dev. You can change the database in file application.properties and add your dependence in build.gradle. The H2 run as runtime db for test and Travis-ci is responsible for the build.
- Spring Boot.
- jjwt - Java JWT: JSON Web Token for Java and Android
The authentication is by JWT between backend and frontend, the responsible for this is Spring Security.
This project run in the port 8081 because the Vue Blog Project run in 8080, but you can change this according to you need, so try it with gradle installed:
$ gradle bootRun
and to test:
$ ./gradlew test
Is different but here because I use PostgreSQL to development and together H2 to test, maybe in your job can be more databases:
- local (First for our tests, create new feature or correct some bug)
- test (db where run test after build)
- dev (development new or correct some feature)
- production
So I use the annotation @ActiveProfiles('test') in my classes of test for use runtime H2 database, you can see this declaration in the build.gradle and to work I use application-test.properties to put more information.
For development in the application.properties I declare my profile
spring.profiles.active: dev
This read the application-dev.properties where I declare the configuration of my database in PostgreSQL.
- Travis-ci is responsible for the build.
- User: User from blog.
- Post: Its my post, have a author and many tags.
- Tag: One post can be one or more tags.
- Role: Each Author has one or more role for now can be Standard User and Administrator.
Obs: I put the suffix blog_ in each table.
Coming soon.
- Intellij Communinty Edition
- DBeaver, to access the database ( For me is the best ide to connection with database for linux)