1.6.1 • Published 2 years ago

@nopcommerce/backend v1.6.1

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

@nopcommerce/backend (unofficial)

This (unofficial) project aims to provide an api client for the official NopCommerce API Plugin. You will need to buy this api seperately to be able to use this package.

This package provides an auto-generated client stub for the NopCommerce Backend API, including typescript type definitions.

Installation

npm i @nopcommerce/backend

Usage

import {
    OpenAPI,
    AuthenticateService,
    StoreService,
} from '@nopcommerce/backend';

// use this api endpoint (make sure to only write the host here, without trailing slash)
OpenAPI.BASE = 'http://localhost:5000';

// get a nopcommerce api token
const response = await AuthenticateService.postGetToken({
    email: 'demo@demo.com',
    password: 'demo',
    is_guest: false,
});

// assign the current token to be used by the api
OpenAPI.TOKEN = response.token;

const allStores = await StoreService.getGetAll();
allStores.forEach((store) => {
    console.log(`${store.name} (${store.url})`);
});

Example application

Head over to the repository here to see a small svelte-based demo application

Contributing

Contributions are always welcome! Please see here for more details

License

MIT