https://github.com/cesarsicas/spring-blog
REST API made with Spring Boot and Java.
https://github.com/cesarsicas/spring-blog
api-server java rest security spring spring-boot
Last synced: 2 months ago
JSON representation
REST API made with Spring Boot and Java.
- Host: GitHub
- URL: https://github.com/cesarsicas/spring-blog
- Owner: cesarsicas
- Created: 2019-05-30T18:40:24.000Z (about 7 years ago)
- Default Branch: master
- Last Pushed: 2019-06-25T17:29:26.000Z (about 7 years ago)
- Last Synced: 2025-05-14T08:12:29.486Z (about 1 year ago)
- Topics: api-server, java, rest, security, spring, spring-boot
- Language: Java
- Homepage:
- Size: 92.8 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
Awesome Lists containing this project
README
# Spring Blog Backend
Simple Blog API, made with Spring Boot and Java. Includes Site and admin area with login.
Also, check the React client for this api https://github.com/cesarsicas/react-blog
### Technologies used on this project
- Spring Boot (Data, Web, Actuator and Security Modules)
- MySQL
- JWT
### Endpoints
- /posts/list [GET]
- /posts/{id} [GET]
- /posts/comments/list [GET]
- /posts/{postId}/comments [POST]
- /admin/posts [GET] *
- /admin/posts/{id} [GET] *
- /admin/posts [POST] *
- /admin/posts/{id} [DELETE] *
Endpoints with * require Bearer Token.
The token is generated doing a request to **/login** with following
```
{
"username" : "teste@teste.com",
"password":"teste"
}
```
### How To test this project
- Clone the repo on your machine. You will need to install Java and Java SDK.
- Choose and compatible IDE (Recommended Intellij IDEA Ultimate Edition)
- Import the Maven Project and install dependencies
- Install MySQL and create a database for the project called "blogdb"
- Create a config file called "application.properties" on /src/resources, with the following content:
```
spring.datasource.url=jdbc:mysql://localhost:3306/blogdb?createDatabaseIfNotExists=true&useSSL=false&serverTimezone=UTC
spring.datasource.username=[your database username with root privillegies]
spring.datasource.password=[your database password]
spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver
spring.jpa.show-sql=true
spring.jpa.open-in-view=true
spring.jpa.hibernate.ddl-auto=create-drop
spring.datasource.initialization-mode=always
spring.datasourse.data=import.sql`
```