Skip to content
Pedro Belo edited this page Aug 12, 2015 · 2 revisions

Endpoints are used to handle requests; they specify what http verbs and paths are exposed by your API.

To create a new one:

$ pliny-generate endpoint todos

Each endpoint is implemented as a standard Sinatra app:

module Endpoints
  class Todos < Base
    namespace "/todos" do
      get do
        serialize Todo.all
      end

      post do
        status 201
        serialize Todo.create(params)
      end
    end
  end
end

Further reading: