Introducing Jooby a minimalist web framework for Java 8 or higher.
-
Simple and effective programming model for building scalable web applications.
-
Easy to learn and to get started. Ideal for small but also large scale applications.
-
Fast, modular and extensible. It is so extensible that even the web server is plugable.
-
Ready for modern web, with a lot of JavaScript/HTML/CSS. It is pretty simple to integrate with grunt, gulp, etc...
import org.jooby.Jooby;
public class App extends Jooby {
{
get("/", () -> "Hey Jooby!");
}
public static void main(final String[] args) throws Exception {
new App().start(args);
}
}Want to learn more?
Check out the quickstart guide.
Jooby uses semantic versioning for releases.
API is considered unstable while release version is: 0.x.x and it might changes and/or broke without previous notification.
This might sounds terrible but isn't. Any change on the API will be reported by the Java Compiler and it wont take you a long time to fix it.
Just paste this into a terminal (make sure Java 8 and Maven 3.x are installed):
mvn archetype:generate -B -DgroupId=com.mycompany -DartifactId=my-app -Dversion=1.0-SNAPSHOT -DarchetypeArtifactId=jooby-archetype -DarchetypeGroupId=org.jooby -DarchetypeVersion=0.4.2.1You might want to edit/change:
-
-DgroupId: A Java package's name
-
-DartifactId: A project's name in lower case and without spaces
-
-Dversion: A project's version, like
1.0-SNAPSHOTor1.0.0-SNAPSHOT
Let's try it!:
mvn archetype:generate -B -DgroupId=com.mycompany -DartifactId=my-app -Dversion=1.0-SNAPSHOT -DarchetypeArtifactId=jooby-archetype -DarchetypeGroupId=org.jooby -DarchetypeVersion=0.4.2.1
cd my-app
mvn jooby:runYou should see something similar to this at the end of the output:
INFO [2015-03-19 21:34:00,365] Hotswap available on: [my-app/public, my-app/config, my-app/target/classes]
INFO [2015-03-19 21:34:00,368] includes: [**/*.class,**/*.conf,**/*.properties]
INFO [2015-03-19 21:34:00,369] excludes: []
INFO [2015-03-19 21:34:00,937] [dev@netty]: App server started in 502ms
GET /assets/** [*/*] [*/*] (anonymous)
GET / [*/*] [*/*] (anonymous)
listening on:
http://0.0.0.0:8080/Jooby! is up and running!!!
A new directory was created: my-app. Now, let's see how it looks like:
.
├── public
| ├── assets
| | ├── js
| | | ├── index.js
| | ├── css
| | | ├── style.js
| | └── images
| └── welcome.html
├── config
| ├── application.conf
| └── logback.xml
└── src
└── main
└── java
└── com
└── mycompany
└── App.javaThe public directory contains *.html, *.js, *.css, ..., *.png files.
The config directory contains *.conf, *.properties, ..., *.json files.
The src/main/java contains *.java (of course) files.
NOTE: Directories: public and config are part of the classpath.
import org.jooby.Jooby;
public class App extends Jooby { // 1
{
// 2
assets("/assets/**");
assets("/", "/welcome.html");
}
public static void main(final String[] args) throws Exception {
new App().start(args); // 3. start the application.
}
}Steps involved are:
-
extends Jooby
-
define some routes
-
call the
startmethod
Just open a console and type:
mvn jooby:run
The maven plugin will compile the code (if necessary) and startup the application.
Of course, you can generate the IDE metadata from Maven and/or import as a Maven project in your favorite IDE.
Then all you have to do is run the: App.java class. After all, this is plain Java application with a main method.
- Fork the project on Github.
- Wondering what to work on? See task/bug list and pick up something you would like to work on.
- Write unit tests.
- Create an issue or fix one from issues.
- If you know the answer to a question posted to our group - don't hesitate to write a reply.
- Share your ideas or ask questions on the jooby group - don't hesitate to write a reply - that helps us improve javadocs/FAQ.
- If you miss a particular feature - browse or ask on the group - don't hesitate to write a reply, show us some sample code and describe the problem.
- Write a blog post about how you use or extend jooby.
- Please suggest changes to javadoc/exception messages when you find something unclear.
- If you have problems with documentation, find it non intuitive or hard to follow - let us know about it, we'll try to make it better according to your suggestions. Any constructive critique is greatly appreciated. Don't forget that this is an open source project developed and documented in spare time.
[Edgar Espina] (https://twitter.com/edgarespina)