mj-mockup-generator
Simple & easy to use mockup generator from MockupsJar
Install
$ npm install mj-mockup-generator
How to use the library
- Register a user on https://mockupsjar.com/
- Go to your profile page and generate a key https://mockupsjar.com/profile
- Use the key with your preferred API tool or library (this package, Postman, Axios)
Usage
const mockupGenerator = require('mj-mockup-generator');
const generator = new mockupGenerator({key: process.env.API_TOKEN});
const data = {
zoomLevel: 0.5,
format: "jpg",
input: ['https://dummyimage.com/750x1334/7dffb8/000000']
};
let response = await generator.render('iphone7-red', data);
console.log('response', response);
List all mockups
const mockupGenerator = require('mj-mockup-generator');
const generator = new mockupGenerator({key: process.env.API_TOKEN});
let response = await generator.list();
console.log(response);
Get info about a specific mockup
const mockupGenerator = require('mj-mockup-generator');
const generator = new mockupGenerator({key: process.env.API_TOKEN});
let response = await generator.getInfo('iphone7-red');
console.log(response);
Render simple mockup
const mockupGenerator = require('mj-mockup-generator');
const generator = new mockupGenerator({key: process.env.API_TOKEN});
const data = {
zoomLevel: 0.5,
format: "jpg",
input: []
};
let task = await generator.render("iphone7-red", data);
console.log(task);
Render mockup with input image
const mockupGenerator = require('mj-mockup-generator');
const generator = new mockupGenerator({key: process.env.API_TOKEN});
const data = {
zoomLevel: 0.5,
format: "jpg",
input: ['https://dummyimage.com/750x1334/7dffb8/000000']
};
let task = await generator.render("iphone7-red", data);
console.log(task);
Render mockup with input website url
const mockupGenerator = require('mj-mockup-generator');
const generator = new mockupGenerator({key: process.env.API_TOKEN});
const data = {
zoomLevel: 0.5,
format: "jpg",
input: ['https://m.imdb.com/title/tt2395427/']
};
let task = await generator.render("iphone7-red", data);
console.log(task);
Resources
MockupsJar - MockupsJar website
MockupsJar API Intro - quick introduction