Skip to content

jerrylee17/casino

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

48 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Casino application

This is a casino!!!

Getting Started

Install the following

Git, Node.js, MySQL

Clone the repository

git clone https://github.com/jerrylee17/casino.git

Install dependencies

npm install

Set up MySQL Server Create a new connection with the following information (development only):

` username: root

password: password

database: blits `

Run the script file in the workbench blits.sql

Run the following to allow MySQL workbench server to connect to our application

  • ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'password';
  • flush privileges;

Lastly, connect to the database named 'blits'

Start backend and frontend In one tab run npm run server In another tab run npm run frontend

Create your own branch and edit there

git checkout -b [YOUR BRANCH NAME]

If you want to push, you must rebase first to get the latest files from master (fix all merge conflicts)

  • git checkout master

  • git fetch origin master

  • git pull origin master

  • git checkout [YOUR BRANCH NAME]

  • git rebase master

Pushing your changes

git add .

git commit -m "Enter a description"

git push origin [YOUR BRANCH NAME]

Open a pull request to merge into master (request review from members)

Frontend/Backend Tutorial

Note: Make sure to import jQuery

import $ from 'jquery';

Send data from Node.js to React.js

Node.js
app.get("/api/test", (req, res) => {
  const test = [
    { id: 1, name: "Name1" },
    { id: 2, name: "Name2" }
  ];
  res.json(test);
});
React.js
$.get("http://localhost:5000/api/test", function(data) {
    console.log(data);
});

Send data from React.js to Node.js

Node.js
app.post("/api/login", function(req, res) {
  console.log(req.body);
  res.send("response");
});
React.js
$.post("http://localhost:5000/api/login", {
    user: "testUser",
    password: "hashedPassword"
});

To create an admin account, the password is secretadminkey