A Typescript/Javascript isomorphic library, for use in HybridForms forms and Node.js.
Typedoc: https://icodeveloper.github.io/hybridforms-js/
- Node.js 18+ is recommended.
To install via NPM:
npm install @icomedias/hybridforms-js
To install locally (for development):
git clone https://github.com/IcoDeveloper/hybridforms-js.git
cd hybridforms-js
npm install
First of all, you need to install the library:
npm install @icomedias/hybridforms-js
Then you're able to import the library and establish the connection with the database:
import { createClient } from '@icomedias/hybridforms-js'
// Create a single HybridForms client for interacting with the API
const hybridforms = createClient({
baseUrl: 'example.hybridforms.com',
clientId: '1',
user: '[email protected]',
password: '123456'
})
You can now use plain <script>
s to import hybridforms-js, like:
<script src="hybridforms.min.js"></script>
Then you can use it from a global HybridFormsJS
variable:
<script>
const { createClient } = HybridFormsJS
const hybridforms = createClient({
baseUrl: 'example.hybridforms.com',
clientId: '1',
user: '[email protected]',
password: '123456'
})
console.log('HybridForms Instance: ', hybridforms)
// ...
</script>
hybridforms-js
uses the node-fetch
library to make HTTP requests, but an alternative xhr
implementation can be provided as an option. This is necessary in HybridForms forms where an authentication is already available:
<script data-hf-src="hybridforms.min.js"></script>
const { createClient } = HybridFormsJS
// Provide a custom `xhr` implementation as an option
const hybridforms = createClient({
baseUrl: 'example.hybridforms.com',
clientId: '1',
xhr: HybridForms.API.XHR.request
})
PRs accepted.
If editing the Readme, please conform to the standard-readme specification.
MIT License © 2023 icomedias GmbH.