Getting Started
JWeb is built on Spring Boot. Get started by cloning the repository.
Coming Soon
We are working to find the best way to make JWeb available for everyone. For now, we will keep you updated.
// please reach out to us if you'd like to try JWeb in its early stageApplication Configuration
Configure JWeb in application.yaml:
server:
port: 8080
spring:
application:
name: MyApp
jweb:
# API base path
api:
base: /api/v1
# MongoDB (optional)
data:
enabled: true
mongo:
uri: ${MONGO_URI:mongodb://localhost:27017}
database: ${MONGO_DB:myapp}Required Imports
import static com.osmig.Jweb.framework.elements.Elements.*;
import static com.osmig.Jweb.framework.styles.CSS.*;
import static com.osmig.Jweb.framework.styles.CSSUnits.*;
import static com.osmig.Jweb.framework.styles.CSSColors.*;Configure Routes
@Component
public class Routes implements JWebRoutes {
public void configure(JWeb app) {
app.pages(
"/", HomePage.class,
"/about", AboutPage.class
);
}
}Create a Page
public class HomePage implements Template {
public Element render() {
return main(
h1("Welcome"),
p("Your first JWeb page!")
);
}
}Run with: mvn spring-boot:run, then visit http://localhost:8080