純正railsアプリをNext.jsに移行する
Railsガイド/3.2
Railsで超簡単API
Ruby on RailsのAPIのconfig/routes.rb書き方【ルーティング備忘録】
Next.js + Ruby on Rails(APIモード) on Docker 構築手順
React + Rails(API)で tokenを用いたCSRF対策の基礎(のメモ)
Rails API + SPAのCSRF対策例
rails-apiのsession認証備忘録
Next.js 日本語マニュアル
SPA, SSR, SSGって結局なんなんだっけ? 結局ReactとNext.jsのどちらで開発を進めればいいの? SPA/MPAとCSR/SSR/SSGの分類 【Next.js入門】Next.jsとは?CSR、SSR、SSG、ISRについて
// 基本構文
docker compose run api rails ---
// routes一覧確認
docker compose run api rails routes
// gemfileを編集後
docker compose build
// modelを作成+migrationも作成
docker compose run api rails g model model名
// db作成
docker compose run api rails db:create
docker compose run api rails db:migrate
// db削除
docker compose run api rails db:drop
// サービスのbashに入る
docker compose exec api /bin/bash
// railsコンソールに入る
rails c
$ docker compose exec db bash
bash-4.2# mysql -h 127.0.0.1 -P 3306 -u root -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 3
Server version: 5.7.40 MySQL Community Server (GPL)
Copyright (c) 2000, 2022, Oracle and/or its affiliates.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql> show database;
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'database' at line 1
mysql> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| mysql |
| performance_schema |
| sys |
| todo_development |
| todo_test |
+--------------------+
6 rows in set (0.00 sec)
mysql> use todo_development
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A
Database changed
mysql> show tables;
+----------------------------+
| Tables_in_todo_development |
+----------------------------+
| active_storage_attachments |
| active_storage_blobs |
| ar_internal_metadata |
| departments |
| schema_migrations |
| sections |
| task_statuses |
| task_types |
| tasks |
| users |
+----------------------------+
10 rows in set (0.00 sec)
mysql> select * from users\G;
Empty set (0.00 sec)