Skip to content

The Web Framework combines multiple JavaWebStack libraries with glue code and helpers to allow fast web development

License

Notifications You must be signed in to change notification settings

JavaWebStack/web-framework

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation



JWS Web Framework

GitHub Workflow Status (branch) GitHub Maven metadata URL GitHub contributors Lines of code Discord Twitter Follow

Introduction

The Web Framework combines multiple JavaWebStack libraries with glue code and helpers to allow fast web development

Quick Example

class MyWebApp extends WebApplication {

    protected void setupConfig(Config config) {
        config.addEnvFile(".env");
    }

    protected void setupModels(SQL sql) throws ORMConfigurationException {
    }

    protected void setupServer(HTTPServer server) {
        server.get("/", exchange -> {
            return "Hello World";
        });
        
        server.controller(new ExampleController());
    }
}

// Example Controller

@PathPrefix("/api/v1")
public class ExampleController extends HttpController {
    @Get("/{name}")
    public GetSomethingResponse getSomething(@Path("name") String name) {
        GetSomethingResponse response = new GetSomethingResponse();
        response.name = name;
        // Automatically Serializes it to JSON if Accept header is not set.
        return response;
    }

    @Post // If empty it uses the /api/v1 route
    public boolean createSomething(@Body CreateSomethingRequest request) {
        // @Body uses JSON for default to unserialize it into an object of the given type, but if the Accept header is set, you can use yaml or form 
        System.out.println(request.name);
        return true;
    }

    // Example Response Model
    public class GetSomethingResponse {
        public String name;
    }

    // Example Request Model
    public class CreateSomethingRequest {
        public String name;
    }
}

Documentation

You can find the current docs on our website. This is a work-in-progress project though so it's not yet complete.

JWS Modules

  • Passport: A library for adding OAuth2 to authenticate in your Application

Community

JWS Modules

Projects built with JWS

About

The Web Framework combines multiple JavaWebStack libraries with glue code and helpers to allow fast web development

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 3

  •  
  •  
  •  

Languages