Skip to content

Commit 68f1bdc

Browse files
authored
Initial commit
0 parents  commit 68f1bdc

33 files changed

+1730
-0
lines changed

.editorconfig

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
root = true
2+
3+
[*]
4+
charset = utf-8
5+
end_of_line = lf
6+
indent_size = 4
7+
indent_style = space
8+
insert_final_newline = true
9+
max_line_length = 120
10+
tab_width = 4
11+
12+
[{*.yaml,*.yml}]
13+
indent_style = tab
14+
indent_size = 2
15+
tab_width = 2

.github/workflows/blog-app.yml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
name: Continuous Integration
2+
3+
on: [push, pull_request]
4+
5+
concurrency:
6+
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
7+
cancel-in-progress: true
8+
9+
jobs:
10+
build:
11+
runs-on: ubuntu-latest
12+
steps:
13+
- uses: actions/checkout@v4
14+
- name: Set up JDK 21
15+
uses: actions/setup-java@v4
16+
with:
17+
distribution: 'corretto'
18+
java-version: '21'
19+
- name: Prepare Maven
20+
run: chmod +x mvnw
21+
- name: Clean
22+
run: ./mvnw clean
23+
- name: Build
24+
run: ./mvnw verify -DskipTests
25+
- name: Test
26+
run: ./mvnw test

.gitignore

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
HELP.md
2+
target/
3+
!.mvn/wrapper/maven-wrapper.jar
4+
!**/src/main/**/target/
5+
!**/src/test/**/target/
6+
7+
### STS ###
8+
.apt_generated
9+
.classpath
10+
.factorypath
11+
.project
12+
.settings
13+
.springBeans
14+
.sts4-cache
15+
16+
### IntelliJ IDEA ###
17+
.idea
18+
*.iws
19+
*.iml
20+
*.ipr
21+
22+
### NetBeans ###
23+
/nbproject/private/
24+
/nbbuild/
25+
/dist/
26+
/nbdist/
27+
/.nb-gradle/
28+
build/
29+
!**/src/main/**/build/
30+
!**/src/test/**/build/
31+
32+
### VS Code ###
33+
.vscode/
34+
35+
######################
36+
# Mac OSX
37+
######################
38+
.DS_Store
39+
40+
41+
######################
42+
# Others
43+
######################
44+
*.class
45+
*.*~
46+
*~
47+
.merge_file*

.mvn/wrapper/maven-wrapper.jar

57.4 KB
Binary file not shown.

.mvn/wrapper/maven-wrapper.properties

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.8.6/apache-maven-3.8.6-bin.zip
2+
wrapperUrl=https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.1.0/maven-wrapper-3.1.0.jar

Dockerfile

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
FROM amazoncorretto:11
2+
3+
COPY mvnw .
4+
COPY .mvn .mvn
5+
COPY pom.xml .
6+
COPY src src
7+
8+
RUN ./mvnw install -DskipTests
9+
10+
EXPOSE 8088
11+
EXPOSE 8082
12+
13+
CMD ["java", "-jar", "target/blog-1.0.0.war"]

README.md

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
2+
## About the app and the exercise
3+
4+
This is a web application, which implements a "blog". You are able to create an account, log in and then write blog posts.
5+
You can also browse and read the blog posts. Take a look through the app, get it running and ideally understand its components.
6+
If you have notes on the implementation, feel free to bring them to our next interview.
7+
8+
This app will also serve as a basis for a code review during the next interview, so make sure you understand the code and
9+
click through the app.
10+
11+
## Running the app
12+
13+
1. You can run the app directly with maven
14+
15+
```
16+
./mvnw spring-boot:run
17+
```
18+
19+
2. You can also run the app with Docker
20+
21+
```
22+
docker build -t blog-app .
23+
docker run -it -p "8088:8088" -p "8082:8082" blog-app
24+
```
25+
26+
## Navigating the blog
27+
28+
Once the app is started it will be available at [localhost:8088](http://localhost:8088).
29+
30+
Some initial users and blog posts are already created using Liquibase.
31+
32+
You can log in the app using the following credentials:
33+
- Username: john
34+
- Password: test
35+
36+
Alternatively you can create a new user at [localhost:8088/signup](http://localhost:8088/signup).
37+
38+
Once logged in, you can create blog posts from here [localhost:8088/blog/create](http://localhost:8088/blog/create).
39+
40+
The index page [localhost:8088](http://localhost:8088) will list all blog posts. Then by clicking on one of the blog posts, you
41+
will be redirected to a page, where you can read the blog post. One example can be found [here](http://localhost:8088/blog/1).
42+
43+
## Application design
44+
45+
This is a simple Spring Boot application, running on Java 11 with an H2 Database. The frontend is built using Thymeleaf.
46+
It also utilizes Liquibase for schema evolution. The app has a built-in authentication using Spring Security.
47+
48+
The app has the following entities and their respective attributes:
49+
50+
User
51+
- id
52+
- username
53+
- password
54+
55+
BlogPost
56+
- id
57+
- title
58+
- content
59+
- author_id -> id of the user, that wrote the blog post
60+
- edited_at -> the last time, that the blog post was edited
61+
- views - the number of times, that the blog post has been read
62+
63+
64+
## Important
65+
66+
If you have any questions or problems running the app please let us know as soon as possible.

0 commit comments

Comments
 (0)