@nopcommerce/backend
TypeScript icon, indicating that this package has built-in type declarations

1.6.1 • Public • Published

@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

Package Sidebar

Install

npm i @nopcommerce/backend

Weekly Downloads

1

Version

1.6.1

License

MIT

Unpacked Size

1.17 MB

Total Files

728

Last publish

Collaborators

  • manuel3108