on 2025 May 13 7:08 AM - last edited 4 weeks ago
I am currently working on a CAP Plugin to call an API oriented service. The purpose of the plugin is to help CAP apps integrate with the service for testing, processing documents as part of a workflow, etc, as the servixe is not currently a CAP app.
Based on the sample plugins provided in the Capire Documentations, the plugins are mostly presented as wrappers/adapters (for example, OData2 Adapter, Auditing), or custom entities (Attachments, Document Management Service). However, I am unable to find sample plugins acting as a service that can be called directly.
Thus, I would like to ask if there any best practices or examples when it comes to service oriented CAP plugins. Is it best to approach designing the plugin in a similar way as you would be designing a CAP service, and letting the host CAP app treat the CAP plugin similarly to a remote service?
Request clarification before answering.
Could you just make a generic npm package rather a CAP Plugin? Could it be similar process for example to the Open AI NPM package: https://www.npmjs.com/package/openai
1. Install -
npm install openai
2. Import it into your service:
import OpenAI from 'openai';
3. Use it within your service:
const client = new OpenAI({ apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted }); const response = await client.responses.create({ model: 'gpt-4o', instructions: 'You are a coding assistant that talks like a pirate', input: 'Are semicolons optional in JavaScript?', });
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
34 | |
21 | |
8 | |
8 | |
5 | |
4 | |
4 | |
4 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.