diff --git a/README.md b/README.md new file mode 100644 index 0000000..75fbdf3 --- /dev/null +++ b/README.md @@ -0,0 +1,92 @@ +

The Informed Artist

+ +

+ + + + + + +

+ +## Table of contents +-------------------- +* [General info](#general-info) +* [Developed by](#developed-by) +* [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. + +## Developed by: +* [Roxanna Vaught-Mijares](https://github.com/roxyvaught) +* [Nicholas Kosik](https://github.com/Thor40) +* [Michael Silva](https://github.com/Silvam2017) +* [Andrea Ballew](https://github.com/andytheelf) + + +## 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: +``` +Log into mysql +``` +Database art_db; +``` +Source db/schema.sql +``` +Quit out +``` +$ npm start +``` +The server should run on PORT 3001 +-------------------- +Alternatively, visit the deployed Heroku site [Heroku](https://the-informed-artist.herokuapp.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 }}} -