Flash is a lightweight, highly expressive multithreaded web framework for Java. It is designed to offer enhanced performance, additional features, and a modernized development experience.
Flash is perfect for building RESTful APIs and simple web applications. Its minimalist design ensures ease of use while maintaining flexibility and power for more advanced needs.
To include Flash in your project, add the following dependency and repository to your pom.xml
:
<dependency>
<groupId>com.pixelservices</groupId>
<artifactId>flash</artifactId>
<version>${flashversion}</version>
</dependency>
<repository>
<id>pixel-services-releases</id>
<name>Pixel Services</name>
<url>https://maven.pixel-services.com/releases</url>
</repository>
Here’s a simple example of a Flash application:
public class HelloWorld {
private final int PORT = 8080;
public static void main(String[] args) {
FlashServer server = new FlashServer(PORT);
server.get("/hello", (req, res) -> "Hello, World!"); //Defines a simple GET route.
//Serves a Swagger visualization of the autogenerated OpenAPI schema
server.openapi("/docs", new OpenAPIConfiguration(
"Flash Server", // Title
"Generated by Flash!", // Description
"1.0", // Version
List.of("http://localhost:" + PORT) // List of servers to be used in Swagger for test API calls
), OpenAPIUITemplate.SWAGGER); // Specifies the type of Swagger UI (can be SWAGGER/REDOC/CUSTOM)
//Serves the contents of a FS folder/resourcestream with MIME types handling.
server.serveStaticFiles("/static", new StaticFileServerConfiguration(
true, // Enable file watching for source folder changes
true, // Enable automatic redirect from /static to /static/index.html
Path.of("path/to/src") // Path to the source folder containing static assets
));
server.start(); //Starts the server
}
}
We welcome contributions! To contribute to Flash:
- Fork the repository: Flash on GitHub
- Create a feature branch:
git checkout -b feature-name
- Commit your changes:
git commit -m 'Add feature'
- Push to the branch:
git push origin feature-name
- Submit a pull request.