MCU-SDK

mcu-sdk

dt l min types v

npm

Introduction

mcu-sdk provides a set of methods to access the data provided by the Marvel Comics API. Marvel Comics data is freely available on the Marvel Developer Portal. You can use mcu-sdk to access that data and use it in your own fun projects. All you need to do is to sign up for a developer account on the Marvel Developer Portal and get your API keys.

Prerequisites

Node.js v18.x LTS or higher is required to use mcu-sdk.

Note: Latest LTS version of Node.js is recommended.

Installation

npm i mcu-sdk

Usage

Initialize the API

const { MarvelAPI } = require("mcu-sdk");

const api = MarvelAPI.init("PRIVATE_KEY", "PUBLIC_KEY");

Replace PRIVATE_KEY and PUBLIC_KEY with your own Marvel API keys. You can get them from the Marvel Developer Portal.

Call any of the available methods

api.{METHOD}({PARAMETERS})

Replace {METHOD} with any of the available methods and {PARAMETERS} with the query parameters you want to pass to the method.

Available Methods

Example

const { MarvelAPI } = require("mcu-sdk");

const api = MarvelAPI.init("PRIVATE_KEY", "PUBLIC_KEY");

api.getAllCharacters()
 .then((response) => {
  console.log(response.data);
 })
 .catch((error) => {
  console.error(error);
 });

Query Parameters

You can pass query parameters to the methods to filter the results. For example:

api.getAllCharacters({
 limit: "10",
 offset: "10",
})
 .then((response) => {
  console.log(response.data);
 })
 .catch((error) => {
  console.error(error);
 });

You can find the list of available query parameters for each method in the Marvel API documentation.

Terms of Use

By using mcu-sdk, you agree to comply with the Marvel API Terms of Use.

You must attribute Marvel as the source of data whenever you display any results from the Marvel Comics API. Please use the following text on every application screen or web page which displays the API result: "Data provided by Marvel. © 2014 Marvel"