$ mvn archetype:generate \
    -DarchetypeGroupId=io.yawp \
    -DarchetypeArtifactId=yawp \
    -DarchetypeVersion=LATEST
Framework
Well designed and scalable APIs

Features


Crafted for APIs

A very simple and elegant domain specific language / framework in Java that helps you to create amazing APIs.

Auto Scaling

It natively supports the Google Appengine Platform. Build your apps, scale automatically.

Platform Free

If scalability is not an issue or you rather do-it-yourself, move to any platform with the PostgreSQL driver.

Models

@Endpoint(path = "/people")
public class Person {
    @Id
    IdRef<Person> id;
    String name;
}

Actions

@PUT("active")
public void activate(IdRef id) {
    Person person = id.fetch();
    person.setActive(true);
    yawp.save(person);
}

Shields

@Override
public void show(IdRef id) {
    allow(isAdmin());
    allow(isUser())
     .where("userId", "=", me());
}

Pipes

@Override
public void flux(Person person,
                 Agg agg) {
    agg.increment();
    agg.sum(person.salary);
}

Transformers

Object upperCase(Person p) {
    Map map = asMap(p);
    map.put("name", p.getName()
          .toUpperCase());
    return map;
}

Hooks

@Override
void beforeSave(Person person) {
    if (person.age < 18)
        throw new
              HttpException(422);
}

Kickstart


Bootstrap your project

$ mvn archetype:generate \
    -DarchetypeGroupId=io.yawp \
    -DarchetypeArtifactId=yawp \
    -DarchetypeVersion=LATEST

Start the development server

$ mvn yawp:devserver

Annotate your models

@Endpoint(path = "/people")
public class Person {
    @Id
    IdRef<Person> id;
    String name;
}

Try with javascript

yawp('/people')
    .create({ name: 'Janes' })
    .then(function(person) { })

Community


  IRC

  Contributors