Community Articles Upload Media to Your Cosmic JS Bucket Using Multer

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


The relationship between content and code has come to an end.
In this video tutorial, I show you how to use the Cosmic CLI to install and deploy a Cosmic JS GraphQL-powered App in 5 minutes.
An application for book lovers to view a list of their favorite books.
An Object in Cosmic JS can be a page, a blog post, an author or anything you want it to be. Cosmic JS gives you the freedom to create and manage content openly and create your own data structure. Each Object allows for the creation of a title, slug, content and Metafields.
In this tutorial I'm going to show you how to create a "Conference" app using a little bit of Node, and Cosmic JS.
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.

Ready to Get Started?

No payment info required.
Start Now   Contact Sales