Back to changelog
Changelog

Quick Bucket setup code sample using the Cosmic NPM module

Tony Spiro's avatar

Tony Spiro

May 21, 2018

Quick Bucket setup code sample using the Cosmic NPM module - cover image

This is a quick example to show some of the powerful things you can do with the Cosmic NPM Module.  This script adds a Bucket to your Cosmic account, adds a Pages Object Type and adds a few Pages.

To run the code:

1. Copy the bucketSetupExample.js file locally into a new folder.
2. cd your-folder; npm i cosmicjs
3. Add your secret authentication token to the code found in Account Settings > Authentication
4. node bucketSetupExample.js

Ready to get started?

Build your next project with Cosmic and start creating content faster.

No credit card required • 75,000+ developers