Skip to content

Commit 170f873

Browse files
committed
files updated
1 parent 7a0f95a commit 170f873

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

64 files changed

+3082
-3103
lines changed

PollingApp/.gitignore

Lines changed: 0 additions & 31 deletions
This file was deleted.

PollingApp/.mvn/wrapper/MavenWrapperDownloader.java

Lines changed: 0 additions & 114 deletions
This file was deleted.

PollingApp/.mvn/wrapper/maven-wrapper.properties

Lines changed: 0 additions & 1 deletion
This file was deleted.

PollingApp/pom.xml

Lines changed: 0 additions & 72 deletions
This file was deleted.

Readme.md

Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
## Building a Full Stack Polls app similar to twitter polls with Spring Boot, Spring Security, JWT, React and Ant Design
2+
3+
![App Screenshot](screenshot.png)
4+
5+
### Tutorials
6+
7+
I've written a complete tutorial series for this application on The CalliCoder Blog -
8+
9+
+ [Part 1: Bootstrapping the Project and creating the basic domain models and repositories](https://www.callicoder.com/spring-boot-spring-security-jwt-mysql-react-app-part-1/)
10+
11+
+ [Part 2: Configuring Spring Security along with JWT authentication and Building Rest APIs for Login and SignUp](https://www.callicoder.com/spring-boot-spring-security-jwt-mysql-react-app-part-2/)
12+
13+
+ [Part 3: Building Rest APIs for creating Polls, voting for a choice in a Poll, retrieving user profile etc](https://www.callicoder.com/spring-boot-spring-security-jwt-mysql-react-app-part-3/)
14+
15+
+ [Part 4: Building the front-end using React and Ant Design](https://www.callicoder.com/spring-boot-spring-security-jwt-mysql-react-app-part-4/)
16+
17+
## Steps to Setup the Spring Boot Back end app (polling-app-server)
18+
19+
1. **Clone the application**
20+
21+
```bash
22+
git clone https://github.com/callicoder/spring-security-react-ant-design-polls-app.git
23+
cd polling-app-server
24+
```
25+
26+
2. **Create MySQL database**
27+
28+
```bash
29+
create database polling_app
30+
```
31+
32+
3. **Change MySQL username and password as per your MySQL installation**
33+
34+
+ open `src/main/resources/application.properties` file.
35+
36+
+ change `spring.datasource.username` and `spring.datasource.password` properties as per your mysql installation
37+
38+
4. **Run the app**
39+
40+
You can run the spring boot app by typing the following command -
41+
42+
```bash
43+
mvn spring-boot:run
44+
```
45+
46+
The server will start on port 8080.
47+
48+
You can also package the application in the form of a `jar` file and then run it like so -
49+
50+
```bash
51+
mvn package
52+
java -jar target/polls-0.0.1-SNAPSHOT.jar
53+
```
54+
5. **Default Roles**
55+
56+
The spring boot app uses role based authorization powered by spring security. To add the default roles in the database, I have added the following sql queries in `src/main/resources/data.sql` file. Spring boot will automatically execute this script on startup -
57+
58+
```sql
59+
INSERT IGNORE INTO roles(name) VALUES('ROLE_USER');
60+
INSERT IGNORE INTO roles(name) VALUES('ROLE_ADMIN');
61+
```
62+
63+
Any new user who signs up to the app is assigned the `ROLE_USER` by default.
64+
65+
## Steps to Setup the React Front end app (polling-app-client)
66+
67+
First go to the `polling-app-client` folder -
68+
69+
```bash
70+
cd polling-app-client
71+
```
72+
73+
Then type the following command to install the dependencies and start the application -
74+
75+
```bash
76+
npm install && npm start
77+
```
78+
79+
The front-end server will start on port `3000`.

0 commit comments

Comments
 (0)