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


Video: Build a Cosmic JS-powered blog using Gatsby
This article shows you how to create a blazing fast Gridsome blog using Cosmic JS source plugin. Let’s get started.
Add the power of Algolia search to your Bucket. This Extension enables you to sync your Cosmic JS Objects with Algolia, making your data searchable. Set up automatic syncing to automatically add / edit / remove content from Algolia. Follow the simple steps below to install and setup Algolia.
The Cosmic JS team was honored to to speak at Toyota Connected for the Ember.js Dallas Meetup this week. Cosmic JS co-founder Tony Spiro presented "Building Modern Apps with API Services" to illustrate the growing trend of offloading core dev tasks onto best-in-class API services.
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.
Thanks to everyone in Dallas who came out to the Vuetiful Holiday Meetup at Simple Media, featuring Vuetify, Netlify and Cosmic JS. 🎉