Skip to content

This is a simple web application built with Java, Spring Boot, and Redis. The application increments a counter every time the home page is visited and displays the current visitor count.

License

Notifications You must be signed in to change notification settings

lyfe691/View_Counter

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Visitor Counter Application

This is a simple web application built with Java, Spring Boot, and Redis. The application increments a counter every time the home page is visited and displays the current visitor count.

Features

  • Visitor Counter: Increments and displays the number of visits to the home page.
  • Redis Integration: Uses Redis to store and manage the visitor count, ensuring persistence across application restarts.
  • Spring Boot: The application is built using Spring Boot, making it easy to run and deploy.

Prerequisites

Before you begin, ensure you have the following installed on your system:

  • Java 11 or higher
  • Maven for dependency management and running the application
  • Redis server

Getting Started

1. Clone the Repository

git clone https://github.com/lyfe691/View_Counter.git
cd View_Counter

2. Configure Redis

Make sure Redis is installed and running on your machine. The application is configured to connect to Redis on localhost at port 6379 by default.


If you dont have redis installed do this:

For Windows

You can't run redis on default on windows, you'll have to use a VM or the Windows Subsystem for Linux (WSL). This is how you can install it:

  1. Powershell (Administator) Run this and restart.
wsl --install
  1. Now that you have WSL installed you can open your terminal and open a new tab as ubuntu or type wsl and enter the following commands:
sudo apt-get update
sudo apt-get install redis
  1. Start Redis
redis-server

For MacOS

  1. Install Homebrew
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
  1. Install Redis
brew install redis
  1. Start Redis
brew services start redis

For Linux

  1. Install Redis
sudo apt-get update
sudo apt-get install redis
  1. Start Redis
redis-server

3. Build the Application

Compile and package the application using Maven:

mvn clean install

4. Run the Application

Start the Spring Boot application:

mvn spring-boot:run

5. Access the Application

Open your web browser and go to:

http://localhost:8080

Each time you refresh the page, the visitor counter will increment.

Project Structure

View_Counter/
│
├── src/
│   ├── main/
│   │   ├── java/
│   │   │   └── com/redis/visitorcounter/
│   │   │       ├── VisitorCounterApplication.java  # Main application class
│   │   │       └── VisitorCounterController.java   # Controller handling the visitor count
│   │   └── resources/
│   │       └── application.properties              # Redis configuration
│   └── test/                                       # Unit tests (if any)
│
├── pom.xml                                         # Maven build file
└── README.md                                       # Project documentation

Technologies Used

  • Java
  • Spring Boot
  • Redis
  • Maven

License

This project is licensed under the MIT License. See the LICENSE file for details.

About

This is a simple web application built with Java, Spring Boot, and Redis. The application increments a counter every time the home page is visited and displays the current visitor count.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages