Chat App by using Nodejs, Graphql, Mysql

Chat App by using Nodejs, Graphql, Mysql

chat-app .This is a chat app by using Nodejs, GraphQL, MySQL

chat-app

This is a chat app by using Nodejs, GraphQL, MySQL

Build MySQL

Use Docker

建立密碼為 root 的 chat 資料庫
docker run --name classsed-chat-mysql -e MYSQL_ROOT_PASSWORD=root -e MYSQL_DATABASE=chat -p 3306:3306 -d mysql:8.0

Modify the config/config.json "host": "0.0.0.0"to connect to the Docker container

透過 Terminal 用 root 帳號登入 chat 資料庫
docker exec -it classsed-chat-mysql mysql -u root -p chat

Added model (table)

Create a new model called User. There will be user.js in the models directory and .js files with date and time numbers in the migrations directory (both can be changed)

sequelize model:generate --name User --attributes username:string,email:string

Update to mysql, create table

sequelize db:migrate

Cancel the last migration (the DB data will be cleared)

sequelize db:migrate:undo
搭配 show tables; 查看上次建立的 table 會消失。
取消所有的migration
sequelize db:migrate:undo:all

Create a new model called Message. Used to record the content of the conversation, sender and recipient

sequelize model:generate --name Message --attributes content:string,uuid:uuid,from:string,to:string
sequelize db:migrate

Add two data

mysql> insert into `users` (`username`, `email`, `createdAt`, `updatedAt`) values ('bacon', '[email protected]', '2020-09-24 10:00:00', '2020-09-24 10:00:00');

mysql> insert into `users` (`username`, `email`, `createdAt`, `updatedAt`) values ('lynn', '[email protected]', '2020-09-24 11:00:00', '2020-09-24 11:00:00');

View the schema of a specific table

查看 users table 欄位
mysql> describes users;

Clear user table data

mysql> delete from users;

Download Details:

Author: baconYao

Source Code: https://github.com/baconYao/chat-app

nodejs javascript node graphql mysql

Bootstrap 5 Complete Course with Examples

Bootstrap 5 Tutorial - Bootstrap 5 Crash Course for Beginners

Nest.JS Tutorial for Beginners

Hello Vue 3: A First Look at Vue 3 and the Composition API

Building a simple Applications with Vue 3

Deno Crash Course: Explore Deno and Create a full REST API with Deno

How to Build a Real-time Chat App with Deno and WebSockets

Convert HTML to Markdown Online

HTML entity encoder decoder Online

Best MySQL DigitalOcean Performance – ScaleGrid vs. DigitalOcean Managed Databases

Compare ScaleGrid MySQL vs. DigitalOcean Managed Databases - See which offers the best MySQL throughput, latency, and pricing on DigitalOcean across workloads.

GraphQL - How To Setup GraphQL Yoga Server with Node.js

Learn How To Setup GraphQL Yoga Server with Node.jS. Learn Set Up Graphql Server With Node and Graphql-Yoga.

Graphql Node JS ( Graphql Server & Client using Apollo ) # 12

Github : https://github.com/tkssharma/Graphql-fullstack-tutorials Graphql Client-Server (Complete Playlist) https://www.youtube.com/playlist?list=PLIGDNOJWiL

Node.js MySQL Tutorial | NodeJS + MySQL Databse Connection Tutorial

We have showed how to use MySQL with Node.js. Node.js is a very popular server-side environment based on javascript. MySQL is probably the most popular relational database management software.

Howw to Build and Deploy a Scalable GraphQL API with Nodejs

A walkthrough for creating and deploying a GraphQL API with Node.js. In this post, you'll see Howw to Build and Deploy a Scalable GraphQL API