Skip to content

Buzut/jamments-front

Repository files navigation

Jamments front

This library is to be used with Jamments comment API.

Jamments is a self hosted commenting API that puts you in control. It's a dead simple REST API that seamlessly integrates with your already existing JAMstack.

This is the frontend API library for Jamments' API. Its aim is to ease Jamments integration within your code. You should go to the documentation for more details.

Also note that this library uses the Fetch API and that it might not be available in older browsers. If you're willing to support older browsers, you can easily polyfill it.

Install with npm or yarn

npm install --save jamments-front

And then just import it as any ES module.

import Jamments from 'jamments-front';

Usage

Here's how you post a new comment

jamments.postComment(slug, comment, name, email, parentId)
.then(() => {
    // comment successfully submitted to the api
})
.catch((err) => {
    // Houston, we had a problem
});