This app allows a user to post an article from another source and other users can comment on the post.
- HTML
- CSS
- JavaScript
- Insomnia (for testing)
- Jest (for testing)
- Handlebars.js
- MySQL
- Sequelize
- dotenv (to create the environmental variables)
- JawsDB (to deploy mySQL to Heroku)
Make sure that you have Node.js installed on your computer by entering node -v in the command line. If successful, the command prompt will return a version number. If not, try reinstalling Node.js by following this link: https://nodejs.org/en/ and clicking on the LTS version. If you are on Windows, make sure to look for the section that says Download for Windows (x64)
. If you are using macOS, make sure to look for the section that says Download for MacOS (x64)
Once Node.js is downloaded, click on the green code button and copy the link to this repository. Then open up your favorite code editor and open the terminal. In the terminal use cd
to go to the root directory you want this repository to be cloned to. Finally, in the terminal, type git clone <file link>
to clone this repository to your directory.
You must also install the Express.js npm package to run the server. Since Express.js is an npm package instead of being built directly into node.js, you must type npm init
into the command line to allow npm packages to be installed. Next, go to the server.js file, and in the command line, type npm install express
to install Express.js on your computer. For documentation on Express.js follow this link https://expressjs.com/en/4x/api.html.
To see and use the deployed site, follow this link to Heroku: https://tech--blog--application.herokuapp.com/
-
After following the link, click the login button at the top right of the screen to be navigated to the login page.
-
Once on the login page, either login using the top login form, or create a new account using the bottom sign-up form.
-
After you login, you will be navigated to the homepage.
-
On the homepage, you can click on the comments button under a post to add a comment on a post.
-
If you wish to create a new post, click on the dashboard button to the left of the logout button at the top of the screen to be navigated to your dashboard where you can create a new post, or view your existing posts.
Permission to use this application is granted under the MIT license. Click on the link for more information: MIT License Information
Jest was used to test the helper functions, which are functions that can be called from a handlebars.js template.
-
To see how these tests work, install jest using the command npm i. This should install jest as well as all the other dependencies for this project.
-
After jest is installed, make sure to go to your
package.json
file, and look underscripts
. In order for jest to work, you must have"test": "jest"
written in thescripts
section. -
Next, type
npm test
in the command line to run the tests. After running thenpm test
command, you should see passing tests in the command line as shown below.
Insomnia was used to seed and test the routes for this app. There is no command for running these tests.
-
To test the application, download insomnia. For more information on Insomnia, follow this link: https://docs.insomnia.rest/.
-
Run
npm run seeds
in the command-line to get preseeded data. -
Run
npm start
to start the server -
Go to Insomnia and test for the route you want to test. Make sure to change the route from GET to POST, PUT, Or DELETE depending on what you want to test for.
-
The routes will be as follows (change users to posts or comments if you would like to test those routes and change :id to the id of the user, post, or comment you want to look for):
- GET (all users): http://localhost:3001/api/users
- GET (one user): http://localhost:3001/api/users/:id
- POST: http://localhost:3001/api/users
- PUT: http://localhost:3001/api/users/1
- DELETE: http://localhost:3001/api/users/2
GitHub Link: (https://github.com/nicnolen)
Email Address: nicnolen@ymail.com