Upload Media to Your Cosmic JS Bucket Using Multer


This is a quick, fully-working example of how to process an uploaded image server-side using Multer.

Open a terminal and run the following commands:

mkdir test
cd test
npm i cosmicjs multer express
vim index.js
// Add the gist code below to index.js
node index.js

Then if you're using Postman. Set this request up to test:

POST http://localhost:5000/upload

Add form-data file to the request.

Let me know if you have any questions! DM me in Slack, or reach out on Twitter.

Photo by Daniel Leone on Unsplash.



Was this article helpful?

Thank you! Your input helps us improve our articles and resources. If you have any other questions or comments, please contact support.

You may also like


Thank you to everyone who joined us for our Halloween edition of our Wednesday Webinar series. In this presentation, we discussed making localization for websites less spooky using Gatsby and Cosmic JS.
Use Cosmic JS as a seamless content management system for displaying large amounts of educational data
Blazing fast blog built using React Static that utilizes the power of Cosmic JS.
Cosmic JS allows developers to deploy their codebases to the Cosmic JS App Server for staging, testing and demo purposes, and is now offering new production deployment options available with some of your favorite deployment services.
The relationship between content and code has come to an end.
An application for book lovers to view a list of their favorite books.