https://github.com/crazyoptimist/rails-api-sr-bootcamp
Rails API - Senior Level
https://github.com/crazyoptimist/rails-api-sr-bootcamp
Last synced: about 1 year ago
JSON representation
Rails API - Senior Level
- Host: GitHub
- URL: https://github.com/crazyoptimist/rails-api-sr-bootcamp
- Owner: crazyoptimist
- Created: 2022-01-14T19:05:19.000Z (over 4 years ago)
- Default Branch: main
- Last Pushed: 2022-02-04T09:15:31.000Z (over 4 years ago)
- Last Synced: 2025-02-05T22:59:03.049Z (over 1 year ago)
- Language: Ruby
- Size: 73.2 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Rails API Sr Basecamp
## DEV ENV SETUP
Install RVM and Ruby, create gemset for your specific project
```bash
# http://rvm.io/rvm/install
\curl -sSL https://get.rvm.io | bash
rvm install 2.7.2
rvm use 2.7.2
rvm gemset create rails-api
```
Add below lines to your `.zshrc` or `.bashrc`(it depends on what terminal you use, like zsh, bash or fish)
```ini
source ~/.rvm/scripts/rvm
rvm use ruby 2.7.2@rails-api
```
Create a new Rails project
```bash
sudo apt-get install postgresql-client libpq5 libpq-dev # I used Debian Bullseye, and the deps are required for using postgresql
rails new api -T --api -d postgresql
```
- `-T`: do not create default test folder (Rails comes with Minitest by default, we drop it to use Rspec instead)
- `--api`: drop template(frontend) related assets/config
Install Rspec and Factory Bot
```
group :development, :test do
# See https://guides.rubyonrails.org/debugging_rails_applications.html#debugging-with-the-debug-gem
gem "debug", platforms: %i[ mri mingw x64_mingw ]
+ gem 'rspec-rails', '~> 5.0.0'
+ gem 'factory_bot_rails'
end
```
```bash
rails generate rspec:install
```