-
Notifications
You must be signed in to change notification settings - Fork 74
Endpoints
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:
- Intro to Sinatra: how to define routes, helpers, filters and more
- Sinatra Namespace
Basics
Diving in
- bin/setup
- Config
- CORS
- Endpoints
- Error Handling
- Logging
- Models
- Mediators
- Migrations
- Rake Tasks
- Request IDs
- RequestStore
- Schema
- Serialization
- Testing
- Updating
Guides