Back to blog
Blog

Upload Media to Your Cosmic Bucket Using Multer

Archived
Community
Tony Spiro's avatar

Tony Spiro

August 23, 2019

Note: This article has been archived as it may contain features or techniques not supported with the latest version of Cosmic.

cover image

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.