strapi-voting-lite
v1.1.8
Published
Add a simple voting system to any Strapi collection type.
Downloads
2
Readme
Strapi Voting
A plugin for Strapi Headless CMS that provides a simple voting system together with a moderation panel and logs.
✨ Features
- Any Content Type relation: Voting system can be linked to any of your content types, both collection and single.
- Voting modes: Allows users to either vote once per day per for one entity out of the collection, once per day per every entity of the collection or customizable per specific needs.
- Moderation Panel: Search and filter through the logs and see various voting statistics.
- Simple to use and change: Plugin is designed to provide a simple and seamless experience with extensive configuration compatabilities.
⏳ Installation
(Use npm to install this plugin within your Strapi project (recommended). Install npm with these docs.)
npm install strapi-voting-lite@latest
After successful installation you've to build a fresh package that includes plugin UI. To achieve that simply use:
npm run build
npm run develop
or just run Strapi in the development mode with --watch-admin
option:
npm run develop --watch-admin
The Voting plugin should appear in the Plugins section of Strapi sidebar after you run app again.
🕸️ Public REST API specification
Vote
POST <host>/voting/api::<collection name>.<content type name>:<entity id>
Vote for a specific entity of a content type, for example Page
with ID: 1
.
Everytime You call this endpoint, on success, selected entities votes
field will be increased by +1 and a user and a votelog will be created accordingly.
Example URL: https://localhost:1337/voting/api::page.page:1/vote
Example response body
{
"createdAt": "2022-04-26T12:50:49.954Z",
"id": 1,
"publishedAt": "2022-04-26T12:50:50.600Z",
"title": "Apple pie",
"updatedAt": "2022-04-28T12:17:45.893Z",
"votes": 64
}
Enjoy 🎉