https://github.com/simran1002/3d-materials
This is a Node.js backend for managing 3D printing materials. It utilizes MongoDB to store information about various 3D printing materials and includes functionality for handling image uploads associated with each material.
https://github.com/simran1002/3d-materials
3d-printing mongodb multer-storage nodejs
Last synced: about 1 month ago
JSON representation
This is a Node.js backend for managing 3D printing materials. It utilizes MongoDB to store information about various 3D printing materials and includes functionality for handling image uploads associated with each material.
- Host: GitHub
- URL: https://github.com/simran1002/3d-materials
- Owner: simran1002
- Created: 2024-06-27T17:55:26.000Z (almost 2 years ago)
- Default Branch: main
- Last Pushed: 2024-06-28T19:05:01.000Z (almost 2 years ago)
- Last Synced: 2025-01-21T13:51:51.489Z (over 1 year ago)
- Topics: 3d-printing, mongodb, multer-storage, nodejs
- Language: JavaScript
- Homepage:
- Size: 24.4 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: Readme.md
Awesome Lists containing this project
README
# 3D Printing Materials Backend
This is a Node.js backend for managing 3D printing materials. It utilizes MongoDB to store information about various 3D printing materials and includes functionality for handling image uploads associated with each material.
## Features
- CRUD operations for 3D printing materials
- Image upload and storage
- Validation and error handling
## Prerequisites
- Node.js installed
- MongoDB installed and running
## Setup
1. Clone the repository
```bash
git clone https://github.com/simran1002/3D-Materials.git
cd 3d-printing-backend
```
2. Install dependencies
```bash
npm install
```
4. Start the server
```bash
npm start
```
## API Endpoints
### Get All Materials
- **URL**: `/api/materials`
- **Method**: `GET`
- **Description**: Fetch all materials from the database, excluding image data.
### Get Material by ID
- **URL**: `/api/materials/:id`
- **Method**: `GET`
- **Description**: Retrieve a specific material by its ID, including its associated image.
### Create a New Material
- **URL**: `/api/materials`
- **Method**: `POST`
- **Description**: Add a new material to the database, including an image upload.
- **Form-Data**:
- `name`: Name of the material (Text)
- `technology`: Printing technology used (Text)
- `colors`: Array of available colors (Text, e.g., `["Red", "Blue"]`)
- `pricePerGram`: Price per gram of the material (Text)
- `applicationTypes`: Array of application types (Text, e.g., `["Prototyping", "Mechanical Parts"]`)
- `image`: Image file representing the material (File)
### Update a Material by ID
- **URL**: `/api/materials/:id`
- **Method**: `PUT`
- **Description**: Update an existing material's details, optionally updating its associated image.
- **Form-Data**: Same as the `POST` request.
### Delete a Material by ID
- **URL**: `/api/materials/:id`
- **Method**: `DELETE`
- **Description**: Remove a material from the database by its ID.