Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Suspenders for API-only app? #943

Open
mike-burns opened this issue Oct 11, 2018 · 3 comments
Open

Suspenders for API-only app? #943

mike-burns opened this issue Oct 11, 2018 · 3 comments
Labels
Enhancement Features we're considering adding

Comments

@mike-burns
Copy link
Contributor

Provide an answer to the question: should I use Suspenders if my app renders no HTML?

@croaky
Copy link
Contributor

croaky commented Oct 11, 2018

FWIW, I created a Rails app in API-only mode recently with:

rails new projectname -d postgresql --api --skip-turbolinks --skip-action-cable --skip-spring --skip-coffee --skip-bootsnap --skip-test --skip-active-storage

Made some edits, first commit looked something like this: https://gist.github.com/croaky/f11ff9e3be24ad317e6f175efcb07048

About two months later, Gemfile looks something like this:

# frozen_string_literal: true

source 'https://rubygems.org'

ruby '2.5.1'

gem 'clearance', '~> 1.16.1'
gem 'lograge', '~> 0.10'
gem 'pg', '>= 0.18', '< 2.0'
gem 'puma', '~> 3.11'
gem 'rails', '~> 5.2.1'

group :development, :test do
  gem 'byebug'
  gem 'dotenv-rails', '~> 2.5.0'
  gem 'factory_bot'
  gem 'rspec-rails'
  gem 'shoulda-matchers', '~> 3.1'
  gem 'webmock'
end

group :development do
  gem 'letter_opener', '~> 1.6.0'
  gem 'listen', '>= 3.0.5', '< 3.2'
end

config/initializers/clearance.rb something like this:

# frozen_string_literal: true

Clearance.configure do |config|
  config.allow_sign_up = false
  config.httponly = true
  config.mailer_sender = '[email protected]'
  config.rotate_csrf_on_sign_in = true
  config.routes = false
  config.secure_cookie = true
end

@mike-burns
Copy link
Contributor Author

Thank you for this, @croaky ! I especially love knowing what the Gemfile looks like after two months of use.

@stevepolitodesign
Copy link
Contributor

stevepolitodesign commented May 17, 2024

In #1135 we introduced suspenders:install:web to allow for the possibility of suspenders:install:api. That pull request also introduced guards to ensure suspenders:install:web cannot be run on an API-only application.

@stevepolitodesign stevepolitodesign added the Enhancement Features we're considering adding label May 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Enhancement Features we're considering adding
Projects
None yet
Development

No branches or pull requests

3 participants