English | 简体中文
A Web rapid development framework
<dependency>
<groupId>cool.scx</groupId>
<artifactId>scx-core</artifactId>
<version>{version}</version>
</dependency>
import cool.scx.core.Scx;
import cool.scx.core.ScxModule;
import cool.scx.http.HttpMethod;
import cool.scx.web.annotation.ScxRoute;
// Note : Custom modules need extends ScxModule
// This @ScxRoute indicate this class needs to be scanned by WebHandler
@ScxRoute
public class YourModule extends ScxModule {
public static void main(String[] args) {
// Use Scx Builder, build and run project
Scx.builder()
.setMainClass(YourModule.class) // 1, The class of the Main method
.addModule(new YourModule()) // 2, Your own modules
.setArgs(args) // 3, External parameters
.run(); // 4, Build and run project
}
// This @ScxRoute indicate this method is a WebHandler
// The path is "" and the request method is GET
@ScxRoute(value = "", methods = HttpMethod.GET)
public String helloWorld() {
// The content that will be sent to the client
return "Hello World";
}
}
2. Use your browser to access http://localhost:8080/ , you should see this .
Hello World
For more information, see docs