From 332427db3047bbe42e0650988f7d4cfabd7b179b Mon Sep 17 00:00:00 2001 From: Thor40 Date: Thu, 9 Jul 2020 20:58:23 -0500 Subject: [PATCH 1/5] readme basic layout --- README.md | 67 ++++++++++++++++++++++++++++++++++ controllers/api/post-routes.js | 3 -- models/User.js | 4 +- views/layouts/main.handlebars | 1 - 4 files changed, 69 insertions(+), 6 deletions(-) create mode 100644 README.md diff --git a/README.md b/README.md new file mode 100644 index 0000000..244bb17 --- /dev/null +++ b/README.md @@ -0,0 +1,67 @@ +# The Informed Artist + +## Table of contents +-------------------- +* [General info](#general-info) +* [Technologies](#technologies) +* [Setup](#setup) +* [Testing](#testing) +* [Features](#features) + +## General info +-------------------- +This project was created as an exercise practicing creating a site using the Model-View-Controller (MVC) directory organization +and its respective npm packages. + +## Technologies +-------------------- +Project is created with: +* bcrypt: ^5.0.0 +* connect-session-sequelize: ^7.0.0 +* dotenv: ^8.2.0 +* express: ^4.17.1 +* express-handlebars: ^4.0.4 +* express-session: ^1.17.1 +* mysql2: ^2.1.0 +* path: ^0.12.7 +* sequelize: ^5.21.13 +* serve-static: ^1.14.1 + +## Setup +-------------------- +### To run this project, make sure to install [MySQL](https://www.mysql.com/downloads/) + +install the following locally using npm: + +``` +$ cd ../dir +$ npm init +$ npm install --save mysql2 +$ npm install --save sequelize +$ npm install dotenv +$ npm install bcrypt +$ npm install express +$ npm install --save path +$ npm install express-handlebars +$ npm install express-session +$ npm install connect-session-sequelize +$ npm install serve-static +``` + +## Testing +-------------------- +### To test this project, run the following in the terminal: +``` +$ npm start +``` +The server should run on PORT 3001 +-------------------- +Alternatively, visit the deployed Heroku site [Heroku](https://dashboard.heroku.com/) + +## Features +-------------------- +### Features include: +* Allows Login or Register new User +* Shows Dashboard that allows creation of new Post +* User can Upvote, Comment, Edit, and Delete Posts +* User can Log out \ No newline at end of file diff --git a/controllers/api/post-routes.js b/controllers/api/post-routes.js index 49872b1..3ccab55 100644 --- a/controllers/api/post-routes.js +++ b/controllers/api/post-routes.js @@ -141,9 +141,6 @@ router.put('/:id', withAuth, (req, res) => { // DESTROY post router.delete('/:id', (req, res) => { - - - Post.destroy( { where: { diff --git a/models/User.js b/models/User.js index 054e012..841ca99 100644 --- a/models/User.js +++ b/models/User.js @@ -34,7 +34,7 @@ User.init( type: DataTypes.STRING, allowNull: false, // there cannot be any duplicate email values in this table - unique: true, + unique: false, // if allowNull is set to false, we can run our data through validators before creating the table data validate: { isEmail: true @@ -43,7 +43,7 @@ User.init( // define a password column password: { type: DataTypes.STRING, - allowNull: false, + allowNull: true, validate: { // this means the password must be at least four characters long len: [4] diff --git a/views/layouts/main.handlebars b/views/layouts/main.handlebars index ae35d5f..cd769b2 100644 --- a/views/layouts/main.handlebars +++ b/views/layouts/main.handlebars @@ -55,7 +55,6 @@
{{{ body }}} -