Giter VIP home page Giter VIP logo

todo-rails-on-nextjs's Introduction

TODO アプリ + Next.js

純正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あたりのお話

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

DBシェル

$ 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)

todo-rails-on-nextjs's People

Contributors

kei-tenkawa avatar

Watchers

 avatar

todo-rails-on-nextjs's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.