A professional Node.js SDK for building applications on the Joonweb platform.
npm install @joonweb/apiInitialize the global SDK context:
import { Context } from '@joonweb/api';
Context.init({
apiKey: process.env.JOONWEB_CLIENT_ID,
apiSecret: process.env.JOONWEB_CLIENT_SECRET,
apiVersion: '26.0',
appName: 'My Node App'
});import { OAuth } from '@joonweb/api';
const authUrl = OAuth.getAuthorizationUrl('example.myjoonweb.com', ['read_products', 'write_products'], 'https://yourapp.com/callback');
// Redirect user to authUrl...
// In your callback route:
const tokenData = await OAuth.exchangeCodeForToken('example.myjoonweb.com', req.query.code);import { JoonWebAPI } from '@joonweb/api';
const api = new JoonWebAPI('access_token_here', 'example.myjoonweb.com');
async function fetchProducts() {
const products = await api.product.all({ limit: 10 });
console.log(products);
}