A simple blog website project created using Amplication. This project includes features to manage users, blog posts, comments, and categories, with authentication handled via JWT.
- User Authentication (Admin access)
- Create, Read, Update, and Delete (CRUD) operations for Posts
- Commenting on Posts
- Categorization of Posts
- Node.js and npm installed
- An Amplication account
- A relational database (e.g., PostgreSQL, MySQL)
-
Clone the repository:
git clone https://github.com/your-username/blog-website.git cd blog-website
-
Install dependencies:
npm install
-
Configure environment variables: Create a
.env
file in the root directory and add your configurations. For example:DATABASE_URL=your-database-url JWT_SECRET=your-jwt-secret
-
Run the application:
npm run start
- Admin Registration and Login:
- Admin can register and login to manage the content.
- Posts Management:
- Create, Read, Update, and Delete posts.
- Commenting:
- Users can comment on posts.
- Categories:
- Posts can be categorized using different categories.
The REST API for managing the resources includes:
- User Endpoints:
POST /auth/login
: Login for users
- Post Endpoints:
GET /posts
: Get all postsPOST /posts
: Create a new postGET /posts/:id
: Get a single postPUT /posts/:id
: Update a postDELETE /posts/:id
: Delete a post
- Comment Endpoints:
GET /posts/:postId/comments
: Get all comments for a postPOST /posts/:postId/comments
: Create a commentDELETE /comments/:id
: Delete a comment
- Category Endpoints:
GET /categories
: Get all categories
Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.
Here's a list of things that can be improved or added:
- Unit tests
- Front-end integration
- Improved error handling
- Advanced user roles and permissions
MIT
To set up this project in Amplication:
- Create a new project in Amplication
- Define the following data models (entities):
- User
- Post
- Comment
- Category
- Set up the necessary relations between these entities:
- User to Post (one-to-many)
- Post to Comment (one-to-many)
- Post to Category (many-to-many)
- Configure the API endpoints and permissions as described in the API Endpoints section
Note: While Amplication can generate much of the boilerplate code for your application, you may need to customize some aspects to fully implement all the features described in this README. For example, you might need to add custom logic for user authentication and authorization.