<dependency>
<groupId>com.github.sparkMllib</groupId>
<artifactId>java-express</artifactId>
<version>1.0.0</version>
</dependency>
import express.Express;
public class App {
public static void main(String[] args) {
Express app = new Express();
app.get("/", (req, res) -> {
res.send("Hello, World!");
});
app.listen(3000);
System.out.println("Server is running on port 3000");
}
}
app.use((req, res, next) -> {
System.out.println("Middleware executed");
next();
});
app.use(Express.static("public"));
app.use((req, res, next) -> {
res.status(404).send("Page not found");
});