GithubHelp home page GithubHelp logo

jaguililla / sabina Goto Github PK

View Code? Open in Web Editor NEW

This project forked from perwendel/spark

15.0 3.0 2.0 5.01 MB

A Sinatra inspired framework for Java 8

Home Page: http://there4.co/sabina

Shell 0.34% Java 77.62% HTML 0.08% CSS 0.29% Groovy 18.84% FreeMarker 2.83%

sabina's Introduction

THIS PROJECT IS DISCONTINUED...

If you are looking for a micro web framework for the JVM, you can check Hexagon which is a port of Sabina (with ideas from Jooby and others) written in Kotlin. It was funny while it last!

Build Img Coverage Img Download Img Kanban Img

Sabina - a Sinatra inspired web framework

Sabina is available at JCenter!!!

dependencies {
  compile ('sabina:http:1.3.2') { transitive = false }
  // Import the backend you are going to use
  compile 'io.undertow:undertow-servlet:1.2.8.Final'
}
<dependency>
  <groupId>sabina</groupId>
  <artifactId>http</artifactId>
  <version>1.1.1</version>
</dependency>

API Docs: HTTP Extra

Getting Started

import static sabina.Sabina.*;

public class HiWorld {
    public static void main (String[] args) {
        get ("/hello", it -> "Hi World!").start ();
    }
}

View at: http://localhost:4567/hello

You can also check out the javadoc. After getting the source from github run:

./gradle/wrapper javadoc site

The result is put in /build/docs/javadoc

The Mission

The purpose of the project is to provide a micro Web framework with the following priorities (in order):

  • Simple to use
  • Easily hackable
  • Extensible to different backends
  • Be small

IDE Settings

Take care of the output path in IntelliJ, for Gradle projects maybe the tests classes are not generated in the same place as Gradle itself.

Examples

Check out and try the examples in the source code.

Simple example showing some basic functionality ([SimpleExample.java][Simple]) [Simple]: //github.com/jamming/sabina/tree/master/http/src/test/java/sabina/examples/SimpleExample.java

Example showing a very simple (and stupid) authentication filter that is executed before all other resources ([FilterExample.java][Filter]) [Filter]: //github.com/jamming/sabina/tree/master/http/src/test/java/sabina/examples/FilterExample.java

Example showing how to use attributes ([FilterExampleAttributes.java][FilterAttributes]) [FilterAttributes]: //github.com/jamming/sabina/tree/master/http/src/test/java/sabina/examples/FilterExampleAttributes.java

Example showing how to serve static resources ([StaticResources.java][StaticResources]) [StaticResources]: //github.com/jamming/sabina/tree/master/http/src/test/java/sabina/examples/StaticResources.java

Example showing how to define content depending on accept type ([JsonAcceptTypeExample.java][JsonAcceptType]) [JsonAcceptType]: //github.com/jamming/sabina/tree/master/http/src/test/java/sabina/examples/JsonAcceptTypeExample.java

Example showing how to render a view from a template ([FreeMarkerExample.java][FreeMarker]) [FreeMarker]: //github.com/jamming/sabina/tree/master/http/src/test/java/sabina/examples/FreeMarkerExample.java

You can also check the ([integration tests]) [integration tests]: //github.com/jamming/sabina/tree/master/http/src/test/java/sabina/it/undertow

License

Copyright © 2014 Juan José Aguililla. All rights reserved.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

[http://www.apache.org/licenses/LICENSE-2.0]

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.