Thanks to visit codestin.com
Credit goes to github.com

Skip to content

rrejuso/OnTrak

 
 

Repository files navigation

M.E.R.N Passport MySQL

Build Status

Node.js using the Express framework with a React client application using MySQL to log the user in with passport with the passport-local strategy using a username and password.

My intentions creating this repository was to learn passport, as well as create a good amount of example code for others to help them create a successful user login system.

App Heroku hosted application View here: Passport-mern

Getting Started

Currently to run the application you will need to:

  • Clone the repository locally
git clone https://github.com/Vincent440/passport-mern-sql.git
  • Create a .env File and store all the database connection information, Or any other environment variables that will change depending on where the application is hosted.
# Port to host application on.
PORT=3001

# Name of the mysql database you will be connecting to.
DB_NAME=mernpassportexample

# Host name for connecting to MySQL database
DB_HOST=hostname

#Port to connect to MySQL database
DB_PORT=3306

# User for connecting to MySQL database
DB_USER=userstringhere

# Password for connecting to MySQL database
DB_PASSWORD=passwordstringhere
  • Run npm install commands to pull in the required packages:
npm install
  • Run the Database schema.sql to set up the database structure.

passport-mern-sql/config/schema.sql

  • Run the Database seeds.sql file

passport-mern-sql/config/seeds.sql

Then you should be all set to start making changes to the application.

Hosting the application.

In order to deploy this application:

you will need to ensure have a mysql database attached to your server. The way this application is set up the .env variables will need to match how the local database .env variables are set up.

I used Heroku to deploy my application. to do the same you will need to:

  • Have a Heroku account or create one.
  • assuming you have an account. log in to the Heroku website.
  • Create a new app and name it whatever you would like to match your applications initial Heroku url.
  • Open your application name from the dashboard on Heroku's website and select Deploy
  • Select Github and login to Github to connect your account to Heroku
  • After succesfully connecting to Github connect the app to the github repository
    • Select the Github account you are using and search for the repository using the search box provided.
    • If you searched successfully you will see the repository you are looking for and have a Connect button.
    • After pressing Connect you have the option to either select a branch and setup automatic deployments or manually deploy whenever you want to test your latest build in a branch. up to you.

Issues || Questions?

  • Question? Open a Ticket here

  • Issue? Open a Ticket here

    • Please leave a brief description
    • Details surrounding the problem
    • Attempts you took to fix it.
    • OS you are using.

Contributers

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 91.2%
  • HTML 6.8%
  • TSQL 2.0%