Laughs is a web web app built to be a social platform for sharing jokes and connecting with others!
To run this application locally, you'll need to:
git clonethis repocdinto the local repopipenv installto install the backend dependencies- Create a
.envfile based on the.env.examplefile included in the repo with your own values - Create a user on your local machine with the username and password specified in your
.envfile in PostgreSQL - Create a database on your local machine with the name specified in your
.envfile in PostgreSQL - Go into the pipenv shell with
pipenv shell - Run
flask db upgradeto run the migrations - Run
flask seed allto seed the database - Open another terminal and cd into the
react-appdirectory and runnpm installto install frontend dependencies - Create your own
.envfile in thereact-appdirectory based on the.env.examplethere - Start your Flask backend in the terminal that's in the root of the local project with
flask run - Finally, start the frontend server with
npm startinside thereact-appdirectory. The application should automatically open in your default web browser. - If you desire further modifications simply create a new branch and
git pushyour changes to Github.
- Python
- PostgreSQL
- SQLAlchemy
- Flask
- WTForms
- React
- Redux
- JavaScript
- TailWindCSS
- Node.js
- AWS S3
- Docker
- Heroku
Here's a link to our live app!
Here's a link to our Wiki!
Users can:
- Post a joke
- Update their joke
- Browse jokes and comment on jokes
- Message others
- Search for specific jokes
The biggest part of the Laughs application is the Joke feed which takes in all jokes, then filters for comments on each joke and attaches a form to add a comment to a joke.
return (
<div className="col-start-3 col-end-6 row-start-5 row-end-7 w-full h-full" >
{allJokes.reverse().map((post) => {
const { id, joke, jokeType } = post;
const myDate = new Date(post.timestamp);
const filteredComments = jokeComments.filter(joke => (joke.jokeId === id));
return (
<div key={id} className="rounded-lg border-4 border-light-blue-500 border-opacity-50 p-1 m-2">
<h3 className="ml-1">{post.users.username}</h3>
<h3 className="ml-1">Joke Type: {jokeType}</h3>
<h3 className="ml-1">{myDate.toLocaleString()}</h3>
<h3 className="text-lg ml-1">{joke}</h3>
{filteredComments && filteredComments.map(comment => {
let user = allUsers.filter(usrObj => (usrObj.id === comment.userId));
return (<div key={comment.id} className="text-sm items-center bg-blue-joker my-1 ml-4 pl-1 rounded-lg w-2/5">
{user[0].username}: {comment.comment}
</div>)
})}
<ThreadForm id={id} />
</div>
)
})}
</div>
)
