Skip to content

briwagner/learn-buffalo

Repository files navigation

Learn Buffalo

This repo contains the code used in the Learn Buffalo video course.

Updated Dec. 2023 to work with go:embed directive and other changes for Buffalo version 18.14

Sections Completed:

  1. Part 1: new project, static page, and route parameters
  2. Part 2: create a user model, add fields and methods, and test it
  3. Part 3: models and associations, one-to-one, one-to-many, many-to-many
  4. Part 4: using controllers with our models
  5. Part 5: HTML templates, partials and helpers
  6. Part 6: Forms, form_for() helper, form() helper, manually parse and grab form values from the request
  7. Part 7: Middleware and user authentication with Buffalo Plugins
  8. Part 8: Third-party Integrations and Events
  9. Part 9: CLI operations to build a production build, and other tasks
  10. Part 10: Develop and Deploy with Docker, using a cloud hosted database, or with docker-compose

Installation

Fork the project (if you want to commit and push your own changes). Each part listed above has a matching branch. The branch for part-6, for example, is the end-state of the project code at the completion of video part-6. If you want to follow along with the part-6 video, you can checkout part-5 and start making changes. After cloning the repo to your local machine, git checkout {branch-name} to view the part.

When changing branches, use these handy buffalo commands to get a clean project state:

  • buffalo pop reset - this will wipe the database and rebuild with the migrations
  • buffalo task db:seed - part-4 and beyond include a DB seed task; this will load the relevant data into your dev database
  • buffalo test - run the tests to make sure everything is working before you get started
  • buffalo dev - run the dev server to see the site in your browser

Buffalo Project

The project site http://gobuffalo.io has lots of great documentation there.