Skip to content

Commit

Permalink
Update server.js (#6)
Browse files Browse the repository at this point in the history
  • Loading branch information
jeevitha011 authored Feb 28, 2024
1 parent ab1f78b commit 3805311
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions xmpl/srv/server.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,13 @@
const cds = require('../../cds-plugin')
const cds = require('../../cds-plugin');
const fs = require('fs');

async function generateOpenAPI (filePath) {
const openapiFile = await cds.compile(`file:${filePath}`).to.openapi({ service: "ProcessorService" });
console.log(openapiFile)
async function generateOpenAPI(filePath) {
const openapiDocument = await cds.compile(`file:${filePath}`).to.openapi({ service: "ProcessorService" }); // to generate document for single service
fs.writeFile('./openapi.json', JSON.stringify(openapiDocument), err => {
if (err) {
console.error(err);
}
});
}

generateOpenAPI('./srv/services.cds')

0 comments on commit 3805311

Please sign in to comment.