Total Pageviews

Thursday, 25 December 2025

MERN-Chinese-Poetry

 This project is a full-stack web application that allows users to search for Chinese poetry based on different dynasties, including Tang and Song poems, as well as Shijing. The application uses React for the frontend and Node.js/Express for the backend. 

Features

  • View Random classic Poems at Home Page
  • Search poems by dynasty (Tang, Song)
  • Search Shijing poems
  • Pagination support for browsing multiple pages of results
  • Responsive design with Tailwind CSS
  • RESTful API backend with Express and MongoDB

Installation

Prerequisites

  • Node.js (v14 or higher)
  • MongoDB

Clone the repository

git clone https://github.com/liuyuelintop/mern-chinese-poetry.git
cd mern-chinese-poetry

Install dependencies

Backend

cd server

npm install

Frontend

cd client

npm install

Configuration

Backend

Create a .env file in the server directory and add the following environment variables:

MONGO_URI=mongodb://localhost:27017/poetrydb

PORT=5001

Frontend

Update the API_BASE_URL in client/src/api/poem.js to match your backend URL:

const API_BASE_URL = "http://localhost:5001/api";

Running the Application

Backend

cd server
npm start

The backend server will start on http://localhost:5001.

Frontend

cd client
npm start

Teck Stack

Frontend

  • React
  • React Query
  • React Router
  • Axios
  • Tailwind CSS

Backend

  • Node.js
  • Express
  • MongoDB
  • Mongoose
  • async-handler (for handling async operations)
  • Cors

API Endpoints

Get Poems by Dynasty

GET /api/poems/dynasty/:dynasty?page=1&limit=10

Search Shijing

GET /api/search/shijing?title=&chapter=&section=&page=1&limit=10

Project Structure

mern-chinese-poetry/
├── client/
│   ├── public/
│   ├── src/
│   │   ├── api/
│   │   ├── components/
│   │   ├──hooks/
│   │   ├── pages/
│   │   ├── App.js
│   │   └── index.js
│   ├── tailwind.config.js
│   ├── postcss.config.js
│   └── package.json
├── server/
│   ├── controllers/
│   ├── db/
│   ├── middlewares/
│   ├── models/
│   ├── routes/
│   ├── .env
│   ├── index.js
│   └── package.json
└── README.md 
from  https://github.com/liuyuelintop/mern-chinese-poetry

No comments:

Post a Comment