📜  yasin (1)

📅  最后修改于: 2023-12-03 15:21:20.484000             🧑  作者: Mango

Yasin: A Simple Yet Powerful Framework for Java

Yasin is a lightweight Java framework that allows developers to easily build web applications. It provides a modular and extensible architecture that allows developers to use only the components and features they need.

Features
  • MVC architecture for building web applications
  • A powerful routing system that allows developers to define custom routing rules
  • Built-in support for RESTful APIs
  • Easy integration with popular tools and libraries such as Hibernate, Spring, and Thymeleaf
  • Simple configuration via annotations and XML files
  • Built-in support for internationalization
  • Extensible and customizable through the use of plugins
Getting started

To get started with Yasin, you first need to add the Yasin dependency to your project. You can do this by adding the following Maven dependency:

<dependency>
    <groupId>com.yasin</groupId>
    <artifactId>yasin-core</artifactId>
    <version>1.0.0</version>
</dependency>

Once you have added the dependency, you can create a new Yasin web application by creating a new class that extends the YasinApplication class:

public class MyApp extends YasinApplication {

    public static void main(String[] args) {
        MyApp app = new MyApp();
        app.start(args);
    }
}

This will create a new Yasin web application that listens on port 8080.

Routing

Yasin provides a powerful routing system that allows developers to define custom routing rules for their web applications. Routing rules are defined using annotations and can be easily customized to meet the specific requirements of your application.

@Controller
public class MyController {

    @GetMapping("/")
    public String index() {
        return "index";
    }

    @PostMapping("/login")
    public String login() {
        return "dashboard";
    }
}

In the example above, we define two routing rules for the MyController class: one for the home page and one for the login page. When a user visits the home page, the index() method will be invoked and the index.html view will be returned. When a user submits a login form, the login() method will be invoked and the dashboard.html view will be returned.

Views

Yasin provides a simple yet powerful view rendering system that allows developers to easily render HTML, JSON, and other types of content. Views are typically defined using templates that can be easily customized to meet the specific requirements of your application.

<!DOCTYPE html>
<html>
    <head>
        <title>My App</title>
    </head>
    <body>
        <h1>Welcome to my app</h1>
    </body>
</html>

In the example above, we define a simple HTML view that displays a welcome message to the user.

Conclusion

Yasin is a simple yet powerful framework for building web applications in Java. Its modular and extensible architecture makes it easy to use and customize, while its powerful routing and view rendering systems allow developers to easily build web applications that meet the specific requirements of their projects.