$ 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.

Google Cloud

Seamless integration of powerful Google Cloud services into a lightweight REST API framework.

Mobile or Web

Access your endpoints from any Node.JS app with a very fluent and extensible javascript client.

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