Skip to content

Jazzy Framework is a lightweight web framework for Java that simplifies web application development with a clear API. πŸš€ Join the community on GitHub to explore features like routing, request validation, and metrics collection! πŸ’»

License

Notifications You must be signed in to change notification settings

Bismark83/jazzy-framework

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

4 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Jazzy Framework 🎢

Jazzy Framework
Releases


Overview

Welcome to Jazzy Framework, a lightweight and developer-friendly Java web framework designed to make building web applications simple and efficient. Whether you are creating a small REST API or a complex web application, Jazzy provides the tools you need to succeed.

Key Features

  • Lightweight: Minimal overhead for maximum performance.
  • MVC Architecture: Easily separate your application logic, making it cleaner and easier to manage.
  • Routing: Simple and intuitive routing for your web applications.
  • Validation: Built-in validation to ensure data integrity.
  • REST API Support: Create robust APIs quickly and easily.
  • Request and Response Handling: Streamlined handling of HTTP requests and responses.

Getting Started

To get started with Jazzy Framework, you need to download the latest version from the Releases section. After downloading, follow these steps to set up your project:

  1. Download the latest release from the Releases page.
  2. Extract the files to your desired location.
  3. Add the Jazzy library to your Java project. You can do this by including the Jazzy JAR file in your project’s build path.
  4. Set up your project structure following the MVC pattern. Create directories for models, views, and controllers.
  5. Start coding your application using the provided APIs.

Example Project Structure

/my-jazzy-app
|-- /src
|   |-- /controllers
|   |-- /models
|   |-- /views
|-- /lib
|   |-- jazzy.jar
|-- /resources
|-- main.java

Installation

Prerequisites

Before you begin, ensure you have the following installed:

  • Java JDK 8 or higher: Make sure you have Java installed on your machine. You can download it from the official Oracle website.
  • Maven or Gradle: These tools help manage dependencies and build your project. Choose one based on your preference.

Using Maven

If you are using Maven, add the following dependency to your pom.xml:

<dependency>
    <groupId>com.bismark83</groupId>
    <artifactId>jazzy-framework</artifactId>
    <version>1.0.0</version>
</dependency>

Using Gradle

For Gradle users, add this line to your build.gradle:

implementation 'com.bismark83:jazzy-framework:1.0.0'

Getting Started with Jazzy

Here’s a simple example to create a basic web application using Jazzy Framework.

Step 1: Create a Simple Controller

Create a new Java class in the controllers directory.

package controllers;

import jazzy.Framework;

public class HomeController {
    public void index() {
        Framework.response().send("Welcome to Jazzy Framework!");
    }
}

Step 2: Define Routes

In your main application file, set up the routing.

import jazzy.Framework;

public class Main {
    public static void main(String[] args) {
        Framework.get("/home", new HomeController()::index);
        Framework.start();
    }
}

Step 3: Run Your Application

Compile and run your application. You should see "Welcome to Jazzy Framework!" when you navigate to /home.

Routing

Jazzy Framework provides a straightforward way to define routes. You can set up routes for GET, POST, PUT, and DELETE requests.

Example Routes

Framework.get("/users", new UserController()::list);
Framework.post("/users", new UserController()::create);
Framework.put("/users/:id", new UserController()::update);
Framework.delete("/users/:id", new UserController()::delete);

Request and Response Handling

Jazzy Framework simplifies the process of handling HTTP requests and responses. You can access request parameters, headers, and body easily.

Accessing Request Data

public void create() {
    String name = Framework.request().getParameter("name");
    // Process the request
}

Sending Responses

public void sendResponse() {
    Framework.response().send("Data processed successfully!");
}

Validation

Validation is crucial for ensuring data integrity. Jazzy Framework includes built-in validation features to help you manage user input effectively.

Example Validation

public void create() {
    String name = Framework.request().getParameter("name");
    if (name == null || name.isEmpty()) {
        Framework.response().send("Name is required.");
        return;
    }
    // Continue processing
}

REST API Support

Creating RESTful APIs is straightforward with Jazzy Framework. You can define routes that correspond to standard HTTP methods.

Example API

Framework.get("/api/users", new UserController()::getAllUsers);
Framework.post("/api/users", new UserController()::createUser);

Middleware

Jazzy Framework supports middleware, allowing you to execute code before or after your routes.

Example Middleware

Framework.use((req, res, next) -> {
    // Perform some action before the request
    next();
});

Error Handling

Error handling is essential for providing a good user experience. Jazzy Framework allows you to define custom error handlers.

Example Error Handler

Framework.error((error) -> {
    Framework.response().send("An error occurred: " + error.getMessage());
});

Logging

Logging is crucial for monitoring your application. Jazzy Framework provides a simple logging mechanism.

Example Logging

Framework.logger().info("User created successfully.");

Testing

Testing your application is important to ensure its reliability. Jazzy Framework supports unit testing with popular testing frameworks.

Example Test

import org.junit.Test;

public class UserControllerTest {
    @Test
    public void testCreateUser() {
        // Write your test here
    }
}

Deployment

Once your application is ready, you can deploy it to your preferred server. Jazzy Framework is compatible with various Java web servers, including Tomcat and Jetty.

Deployment Steps

  1. Package your application as a JAR file.
  2. Upload the JAR file to your server.
  3. Start the server and access your application.

Community

Join our community of developers using Jazzy Framework. Share your projects, ask questions, and collaborate with others.

Contributing

We welcome contributions to Jazzy Framework. If you have ideas for new features or improvements, feel free to open an issue or submit a pull request.

Reporting Issues

If you encounter any bugs or issues, please report them on the Issues page.

Resources

License

Jazzy Framework is licensed under the MIT License. See the LICENSE file for more details.

Conclusion

Jazzy Framework is designed to make Java web development simple and enjoyable. With its lightweight structure and powerful features, you can build robust applications with ease. Download the latest version from the Releases page and start your journey with Jazzy today!

About

Jazzy Framework is a lightweight web framework for Java that simplifies web application development with a clear API. πŸš€ Join the community on GitHub to explore features like routing, request validation, and metrics collection! πŸ’»

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •