Skip to content

Commit

Permalink
improve annotate-openai
Browse files Browse the repository at this point in the history
  • Loading branch information
florianbgt committed Dec 17, 2024
1 parent b3aa193 commit 4893bc9
Show file tree
Hide file tree
Showing 18 changed files with 5,364 additions and 3,297 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,5 @@ dist
.env
napi_dist
__pycache__
.ruff_cache
.ruff_cache
.OPENAIKEY
3 changes: 2 additions & 1 deletion examples/node/express-typescript/.napirc
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{
"entrypoint": "src/index.ts",
"out": "napi_dist"
"out": "napi_dist",
"openaiApiKeyFilePath": "../../.OPENAIKEY"
}
6 changes: 3 additions & 3 deletions examples/node/express-typescript/src/routers/elves.router.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,20 @@ import * as elvesService from "../services/elves.service";

const router = Router();

// @nanoapi path:/api/v0/elves/ method:GET
// @nanoapi method:GET path:/api/v0/elves/
router.get("/", async (_req, res) => {
const elves = await elvesService.findAll();
res.send(elves);
});

// @nanoapi path:/api/v0/elves/:id method:GET
// @nanoapi method:GET path:/api/v0/elves/:id
router.get("/:id", async (req, res) => {
const id = Number(req.params.id);
const elf = await elvesService.findById(id);
res.send(elf);
});

// @nanoapi path:/api/v0/elves/ method:POST
// @nanoapi method:POST path:/api/v0/elves/
router.post("/", async (req, res) => {
const elf = req.body;
const newElf = await elvesService.create(elf);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,20 @@ import * as hobbitsService from "../services/hobbits.service";

const router = Router();

// @nanoapi path:/api/v0/hobbits/ method:GET
// @nanoapi method:GET path:/api/v0/hobbits/
router.get("/", async (_req, res) => {
const hobbits = await hobbitsService.findAll();
res.send(hobbits);
});

// @nanoapi path:/api/v0/hobbits/:id method:GET
// @nanoapi method:GET path:/api/v0/hobbits/:id
router.get("/:id", async (req, res) => {
const id = parseInt(req.params.id);
const hobbit = await hobbitsService.findById(id);
res.send(hobbit);
});

// @nanoapi path:/api/v0/hobbits/ method:POST
// @nanoapi method:POST path:/api/v0/hobbits/
router.post("/", async (req, res) => {
const hobbit = req.body;
const newHobbit = await hobbitsService.create(hobbit);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,20 @@ import * as wizardsService from "./wizards.service";

const router = Router();

// @nanoapi path:/api/v0/wizards/ method:GET
// @nanoapi method:GET path:/api/v0/wizards/
router.get("/", async (_req, res) => {
const wizards = await wizardsService.findAll();
res.send(wizards);
});

// @nanoapi path:/api/v0/wizards/:id method:GET
// @nanoapi method:GET path:/api/v0/wizards/:id
router.get("/:id", async (req, res) => {
const id = parseInt(req.params.id);
const wizard = await wizardsService.findById(id);
res.send(wizard);
});

// @nanoapi path:/api/v0/wizards/ method:POST
// @nanoapi method:POST path:/api/v0/wizards/
router.post("/", async (req, res) => {
const wizard = req.body;
const newWizard = await wizardsService.create(wizard);
Expand Down
3 changes: 2 additions & 1 deletion examples/node/express/.napirc
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{
"entrypoint": "src/index.js",
"out": "napi_dist"
"out": "napi_dist",
"openaiApiKeyFilePath": "../../.OPENAIKEY"
}
3 changes: 2 additions & 1 deletion examples/node/nestjs-typescript/.napirc
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{
"entrypoint": "src/main.ts",
"out": "napi_dist"
"out": "napi_dist",
"openaiApiKeyFilePath": "../../.OPENAIKEY"
}
3 changes: 2 additions & 1 deletion examples/python/flask/.napirc
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{
"entrypoint": "app.py",
"out": "napi_dist"
"out": "napi_dist",
"openaiApiKeyFilePath": "../../.OPENAIKEY"
}
Loading

0 comments on commit 4893bc9

Please sign in to comment.