Upload image file in React to MongoDB

Use react file base64 package to upload the image to mongoDB

Ckmobile
Geek Culture

--

In this article, we are going to create a project to upload the image to the MongoDB.

NodeJS Course:

First, create a folder structure like this

Server side

npm init -ynpm install cors express mongoose nodemon

Models

under “models”, create items.js

Mongoose schema provide a blueprint for creating objects.

import mongoose from 'mongoose';const itemSchema = mongoose.Schema({title:String,image:String},{ timestamps: true })

--

--