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


Publish Blog Articles to a clean and simple UI with Apollo Blog, powered by Apollo Graphql client and Cosmic JS.
Cosmic JS Extensions make it possible to extend the functionality of Cosmic JS for both the developer and editor. A recent example built by the Cosmic JS Community is the Google Analytics Extension, which allows team members to easily see analytics insights directly in their Cosmic JS Bucket.
Now editors can use the new Unsplash Photos Extension to find and add stock photography to their media library, all from the comfort of their Bucket Dashboard without having to interface with a third-party website like Unsplash.
Learn how I built the Twitter Search Extension to search and save Tweets to your Bucket.
Single page app that allows you to showcase you digital products and accepts credit card payment online. Very similar to the marketing sales funnel, but done in simple single page sales funnel.
An application for book lovers to view a list of their favorite books.