A blog app made with React + Node.js during Intellias' JS Invaders Camp.
🚧 Work In Progress 🚧
Live: kubrysh-react-blog-app.herokuapp.com
- 🔌 Usage
- 🌍 Depolyment
- 📚 Homework
- To launch the Development Server of React App:
cd react-blog-app
npm start
- To launch the Node App:
cd node-api-app
npm start
- To launch the local MongoDB database for development usage:
cd mongo-db-docker
docker-compose up --build -d mongodb-blog
React App is deployed on Heroku using create-react-app-buildpack and served via Nginx.
Node App is also deployed on Heroku.
MongoDB database is deployed on Atlas.
- Use mocked (seeded) data from DB
- Add routing to application with calls to back end fetching fake data
- Added routing to React App:
- dynamic routing using URL params to Article pages
- routing to a Not Found Page and redirecting to it in case of a 404 error
- routing to New Article Form, which is displayed as a modal or a page (clicked link in a header - results in a modal, while clicking on the same link from outside the application will open New Article Form as a page.
- conditional routing to a Form Success modal, which is displayed only when invoked from a Form Component
- Improved overall React App structure
- Added corresponding pages & components
- NOTE: I haven't paid much attention to styling as for this homework, because soon I will be adding MUI and redoing everything
- Install MongoDB
- Design a DB structure for the blog application
- Posts
- Comments
- Tags
- Users
- Seed DB and play with different queries (aggregate, filter and sort)
- Created a local MongoDB database via Docker for development usage
- Deployed a cloud MongoDB database on Atlas
- Connected Node App to MongoDB using Mongoose
- Designed a DB structure for Articles, Comments, Tags and Users:
- DB Schema was designed with the following requirements in mind:
- Users can only leave and delete their own comments on the individual article page
- If a user deletes their account - their comments will remain, but the name will change to
Deleted User. The likes will be removed.
- DB Schema was designed with the following requirements in mind:
- Added initial values for DB which are added on docker container creation
- Implemented Article service for DB data quering and writing
- Setup basic back end application
- Serve SPA by Express JS
- Setted up & configured Node + Express server for handling API & Business Logic
- Configured routing & error handling on Express
- Created 2 API Endpoints (GET & POST) for getting existing articles and adding new ones
- Implemented articles fetching from API
- Implemented adding new articles via sending POST requests using form data to API
- Implementeed article data storage in a file
- Deployed React App served by Nginx on Heroku
- Deployed Node App on Heroku
- UPD 05.12.2021: reworked API requests with axios
- Use MaterialUI components
- Add styles
- Focus on: moving from the default browser components and styles to the MaterialUI, make your project clean and good looking
- TBD
Create a basic layout for a personal blog
Create form and validation for publishing an article
- Created a basic blog layout as specified by the image
- Created a form for publishing a new article (!!! To access the form, click on the
✍️ New Articlein the navigation section) - At first, I implemented basic validation with the raw yup library, but error handling was not good enough out of the box.
- So, I switched to
Formiklibrary (which also usesyupfor validation, but allows to get error messages for each field) and reworked the whole form component. - No component division and routing were implemented yet (since these are the tasks of the following homework assignments)
Create a basic project
Create a repository on GitHub
- Created a react app via
create-react-appwith a typescript template
Task #1:
Explain the following regexp:
/\.(t|j)sx?$/.
My solution:
The given regexp is used to test if a file path string ends with: .tsx, .ts, .jsx, .js.
\.– character is a.(escaped dot)(t|j)– the next character istorj(using alternation operator)s– following character is literalsx?–?character matches the preceding itemx0 or 1 times$– specifies that the tested string should end with a previous character (i.e.xors)