Quick start
cargo init my-api && cd my-api
octopux --bootstrap
octopux generate-model --name Project --fields --sqlx --migration --timestamps --openapi --sqlite
--bootstrapasks for the database, OpenAPI and GraphQL (octopux --bootstrap --sqlite --openapianswers them with flags), then writessrc/main.rs(an actix server on127.0.0.1:8085, a SQLite pool ondata.db) andsrc/helpers.rs(theAppStateholding the pool).generate-modelasks for the fields, then writessrc/project.rsand the migration creating theprojecttable.- In
src/main.rs, declare the model withmod project;, mount it with.configure(project::configure)in thev1scope, and uncommentsqlx::migrate!().run(&pool).
cargo run
Generated routes
| Route | Action |
|---|---|
GET /v1/project |
List a page of projects |
GET /v1/project/{id} |
Find a project |
POST /v1/project |
Create a project |
PUT /v1/project/{id} |
Update a project |
DELETE /v1/project/{id} |
Delete a project |
Swagger UI is served on /swagger, the OpenAPI document on /openapi.json.
