-
Notifications
You must be signed in to change notification settings - Fork 74
Writing your first app
Pedro Belo edited this page Aug 6, 2015
·
3 revisions
Lets write a todo API in Pliny, because Ruby developers don't have enough of them!
Assuming you went through the Getting started guide and have Pliny setup, the first step is to create a new app:
$ pliny-new todo-api
This initializes a Pliny template containing all the base files we need to build our Todo app on top. Lets start by initializing the app:
$ cd todo-api
$ bin/setup
This single script will install dependencies, create a database, setup the environment, and more.
At the heart of every API there are resources that users can manipulate. For this example we're going to offer a "todos" resources that users can create and flag as completed. Lets ask Pliny to give us a basic foundation for it:
$ pliny-generate endpoint todo
created endpoint file ./lib/endpoints/todos.rb
add the following to lib/routes.rb:
mount Endpoints::Todos
created test ./spec/endpoints/todos_spec.rb
created test ./spec/acceptance/todos_spec.rb
... to be continued
Basics
Diving in
- bin/setup
- Config
- CORS
- Endpoints
- Error Handling
- Logging
- Models
- Mediators
- Migrations
- Rake Tasks
- Request IDs
- RequestStore
- Schema
- Serialization
- Testing
- Updating
Guides