A RESTful backend API for category management, CRUD operations, and image uploads.
Backend API built with Node.js and Express.js for managing categories, custom categories, and category images.
- Category CRUD: Create, read, update, and delete categories.
- Custom Category Management: Manage custom category records through REST API endpoints.
- Category Image Management: Upload and manage multiple category images.
- File Uploads: Handle image uploads using Multer.
- RESTful API: Structured API endpoints using Express.js.
- MySQL Integration: Designed for MySQL-backed data management.
- CORS Support: Enables communication with frontend applications.
- Static File Serving: Uploaded images are served through a public API path.
- JSON & Form Data Support: Supports JSON requests and URL-encoded form data.
| Technology | Purpose |
|---|---|
| Node.js | JavaScript runtime environment |
| Express.js | REST API and server framework |
| MySQL | Relational database |
| Multer | Image and multipart file uploads |
| CORS | Cross-origin API communication |
| Body Parser | Request body parsing |
| JavaScript | Backend development |
The backend follows a standard REST API architecture:
React Frontend
β
βΌ
Axios
β
βΌ
Express.js REST API
β
βΌ
Admin Routes
β
βΌ
Controller Layer
β
βΌ
MySQL Database
Frontend
β
βΌ
Multipart Form Data
β
βΌ
Multer
β
βΌ
public/images/
β
βΌ
Image URL Served by Express
All administrative endpoints are available under:
/api/admin/
| Method | Endpoint | Description |
|---|---|---|
GET |
/api/admin/category/ |
Fetch all categories |
POST |
/api/admin/category/ |
Create a new category |
PUT |
/api/admin/category/:categoryid |
Update a category |
DELETE |
/api/admin/category/:categoryid |
Delete a category |
| Method | Endpoint | Description |
|---|---|---|
GET |
/api/admin/mycategory/ |
Fetch all custom categories |
POST |
/api/admin/mycategory/ |
Create a custom category |
PUT |
/api/admin/mycategory/:mycategoryid |
Update a custom category |
DELETE |
/api/admin/mycategory/:mycategoryid |
Delete a custom category |
| Method | Endpoint | Description |
|---|---|---|
GET |
/api/admin/mycategoryimage/ |
Fetch category images |
POST |
/api/admin/mycategoryimage/ |
Upload new category images |
PUT |
/api/admin/mycategoryimage/:mycategoryimageid |
Update image records |
DELETE |
/api/admin/mycategoryimage/:mycategoryimageid |
Delete image records |
This backend API was designed to work with a React.js frontend application.
π Frontend Repository:
React Category Management Dashboard
Click to view image upload details
The API uses Multer for handling image uploads.
Single Image Upload
Category images are uploaded using:
ImageMultiple Image Upload
Category image collections support multiple uploads using:
ImagesThe backend supports uploading up to:
10 images per request
Uploaded files are stored in:
public/images/
Images are served through:
/images/<filename>
Example:
http://localhost:5000/images/example.jpg
Click to view project structure
nodejs-category-management-api/
β
βββ app/
β β
β βββ controllers/
β β βββ admin.controller.js
β β
β βββ routes/
β β βββ admin.route.js
β β
β βββ ...
β
βββ public/
β βββ images/
β
βββ package.json
β
βββ main.js
β
βββ README.md
Click to view installation instructions
1. Clone the repository
git clone https://github.com/yeshagevariya/nodejs-category-management-api.git2. Navigate to the project directory
cd nodejs-category-management-api3. Install dependencies
npm install4. Start the API server
node main.jsThe API server will run at:
http://localhost:5000
Click to view frontend integration
This backend API was designed to work with a React.js frontend application. Example Axios request:
axios.get("http://localhost:5000/api/admin/category/");Example image URL for React component:
<img src="http://localhost:5000/images/image-name.jpg" alt="Category" />Click to view api request examples
Create a Category
POST /api/admin/category/The request supports multipart form data with the following fields:
- Name
- Description
- Image Upload Category Images
POST /api/admin/mycategoryimage/The request supports multiple image uploads using the following field:
- Images
This project demonstrates the development of a backend REST API using:
- Node.js & Express.js
- MySQL Database Integration
- RESTful API architecture (CRUD operations)
- Multer for multipart form data and file uploads
- CORS configuration for cross-origin requests
- Static file serving for image retrieval
The API provides the backend foundation for a complete React-based category management dashboard.
Yesha Gevariya
Frontend Engineer building modern web applications and AI-powered products.
Specialized in: React.js Next.js TypeScript JavaScript Node.js REST APIs AI Integration RAG LLM Applications
This project was created for educational and professional development purposes.