Microblog Lite is a simple microblogging platform built with HTML, CSS, and JavaScript. It allows users to create posts, view profiles, and manage their content. The application interacts with a backend API for user authentication, post management, and profile updates.
- User Authentication (Login/Logout)
- View and Edit User Profile Full name and Bio
- Create, Like, and Remove Posts
- Sort Posts by Newest or Oldest
- Responsive Design with Bootstrap
- HTML
- CSS
- JavaScript
- Bootstrap 5
- Fetch API
Make sure you have a modern web browser installed. No additional software is required.
1.Don't forget to read the MicroblogLite API docs and experiment with the API in Postman!
Practice and experimentation provide experience, and experience provides confidence.
- Clone the repository:
git clone https://github.com/etsond/microbloglite-capstone-starter
- Open the
index.html
file in your web browser to start the application.
- Navigate to the landing page (
index.html
). - Enter your username and password to log in.
- If you don't have an account, click "Register" to register.
- After logging in, navigate to the profile page (
./profile/index.html
). - View your profile information.
- Click "Edit Profile" to update your full name and bio.
- Navigate to the posts page (
./posts/index.html
). - View all posts on the page.
- Like or Unlike posts using the like button.
- Remove a posts using the remove button.
- Sort posts by newest or oldest using the dropdown menu.
The application interacts with the backend API hosted at http://microbloglite.us-east-2.elasticbeanstalk.com
. Key endpoints include:
POST /auth/login
: Authenticate a user.GET /auth/logout
: Log out a user.GET /api/users/:username
: Retrieve user profile information.GET /api/posts?username=:username
: Retrieve posts for a user.POST /api/posts
: Create a new post.DELETE /api/posts/:postId
: Remove a post.POST /api/likes
: Like a post.DELETE /api/likes/:likeId
: Unlike a post.
This project is licensed under the MIT License.
- Thanks to the creators of Bootstrap for providing a responsive design framework.
- Thanks to the team behind the API for their support.
Here is an interesting piece of code from the project that handles creating sorting posts:
.then(posts => {
const sortOrder = sortOrderSelect.value;
if (sortOrder === "oldest") {
posts.sort((a, b) => new Date(a.createdAt) - new Date(b.createdAt));
} else {
posts.sort((a, b) => new Date(b.createdAt) - new Date(a.createdAt));
}
displayPosts(posts);
This part of the code allows users to choose how they want to see their posts, either from oldest to newest or newest to oldest, using a dropdown menu. It sorts the posts based on the selected option and then updates the page to display the posts in the chosen order. This make the user experience better by providing control over the display of content, making the app more user-friendly.