Add a simple voting system to any Strapi collection type.
npm install strapi-plugin-votingbash
npm install strapi-plugin-voting@latest
`
After successful installation you've to build a fresh package that includes plugin UI. To achieve that simply use:
`bash
npm run build
npm run develop
`
or just run Strapi in the development mode with --watch-admin option:
`bash
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
$3
POST
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
`json
{
"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
}
``