STROKE OF LUCK
is an interactive Choose Your Own Adventure (CYOA) game where adventurers partake on a journey, guided by chance. The app follows the MVC paradigm in its architectural structure, using Handlebars.js as the templating language,Sequelize as the ORM, the express-session npm package for authentication, and Heroku, the platform hosting the application.
-
express-handlebars package to implement Handlebars.js for views.
-
MySQL2 and Sequelize packages to connect to
STROKE OF LUCK's
database for models -
Express.js API for controllers.
-
dotenv package to use environment variables to store sensitive data, bcrypt package to hash passwords, & express-session and connect-session-sequelize packages to add authentication.
The express-session package stores the session data on the client in a cookie - when an adventurer is idle on
STROKE OF LUCK
for more than a set time, the cookie will expire and the adventurer will be required to log in again to start a new session.
βββββ βββββ
The application is invoked using the following commands:
git clone https://github.com/christiecamp/stroking-luck.git
npm i :: express, mysql2, dotenv --save, sequelize, nodemon --save-dev, handlebars, express-session, express-handlebars, bcypt, connect-session-sequelize
mysql -u root -p
SOURCE db/schema.sql;
quit
npm run seed
nodemon server
INSTRUCTIONS:
-
Open the Integrated Terminal and follow the installation guidelines
-
Interact with
STROKE OF LUCK's
back end with Insomnia by testing the below:- GET all users, stories
- GET user, story by id
- CREATE user, story
- UPDATE user, story,
- DELETE story
view demo videos and testing
-
Open the application deployed on Heroku
-
Signup by creating a username/password
-
Create, update, and delete stories through your dashboard
-
View all stories via the dashboard
-
Logout to leave the application
screenshot demonstrates STROKE OF LUCK's
back end, testing all routes with Insomnia, and the functional application deployed on Heroku
coming soon!
TESTING WITH INSOMNIA:
There are different tools available that can test reading/writing operations in a web browser - in this application we use Insomnia, a REST client that makes it easy to send HTTP requests to an API and view response details.
-
After installing Insomnia, open a new document.
-
Interact with
STROKE OF LUCK'S
back end by testing the below commands:
http://localhost:3013/api/user
http://localhost:3013/api/story
http://localhost:3013/api/user/1
http://localhost:3013/api/story/
{
"title": "",
"content": ""
}
http://localhost:3013/api/post/1
{
"title": "",
"content": ""
}
http://localhost:3013/api/story/
Here's a list of technologies used:
-
Node.js - is an open-source, cross-platform JavaScript runtime environment.
-
Express.js - a minimal and flexible Node.js web application framework that provides a robust set of features for web and mobile applications.
-
Handlebars.js - a JavaScript templating library used in web development to create dynamic web pages and generate HTML content based on data.
-
MySQL2 - MySQL is a relational database management system based on SQL β Structured Query Language.
-
Sequelize - a Node.js based
Object Relational Mapper
that makes it easy to work with MySQL databases. An Object Relational Mapper performs functions like handling database records by representing the data as objects. -
express-handlebars - a Handlebars view engine for Express which doesn't suck.
-
express-session - a Node.js module that offers simple session middleware for Express.
-
connect-session-sequelize - a SQL session store using Sequelize.js.
-
Bcyrpt - a Node.js library to help hash passwords.
-
Dotenv - a zero-dependency module that loads environment variables from a .env file into
process.env
. -
Nodemon - a Node.js tool that helps develop applications by automatically restarting the node application when file changes in the directory are detected.
-
js-confetti - Node.js library to add a little bit of spice to your buttons.
-
Insomnia - an open source desktop application that assists in designing, debugging, and testing APIs (specifically in this instance, HTTP-based RESTful APIs).
-
Heroku - used to deploy, manage, and scale the application.