Skip to content

Commit

Permalink
bug fix
Browse files Browse the repository at this point in the history
  • Loading branch information
pandaind committed Oct 14, 2024
1 parent a8c037f commit baa69be
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions api/index.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,16 @@
const { createInstance, getHttpOperationsFromResource } = require('@stoplight/prism-http');
const { createClientFromSpec } = require('@stoplight/prism-http/dist/client');
const { createInstance} = require('@stoplight/prism-http');
const { parse } = require('url');
const path = require('path');

let prism;


const initializePrism = async () => {
const specPath = path.join(__dirname, '../pos.yml');
const operations = await getHttpOperationsFromResource(specPath);
prism = createInstance({ config: { mock: { dynamic: true } } }, { operations });
const specPath = path.join(__dirname, '../openapi.yaml');
const specContent = await fs.readFile(specPath, 'utf8');
const client = await createClientFromSpec(specContent, { format: 'yaml' });
prism = createInstance({ config: { mock: { dynamic: true } } }, client);
};

module.exports = async (req, res) => {
Expand Down

0 comments on commit baa69be

Please sign in to comment.