Compare commits
3 Commits
750c81f4cb
...
8a67f4fbdb
Author | SHA1 | Date | |
---|---|---|---|
8a67f4fbdb | |||
a208c40e06 | |||
073bc9f8e3 |
22
app.ts
22
app.ts
@ -1,4 +1,4 @@
|
||||
import { Application, Router, HttpError, isHttpError } from "https://deno.land/x/oak@v12.1.0/mod.ts";
|
||||
import { Application, Router, isHttpError } from "https://deno.land/x/oak@v12.1.0/mod.ts";
|
||||
import {
|
||||
searchRepositoryWithTopic,
|
||||
getRepositoryTags,
|
||||
@ -156,9 +156,27 @@ app.use(async (ctx, next) => {
|
||||
app.use(router.routes());
|
||||
app.use(router.allowedMethods());
|
||||
|
||||
app.use(async (ctx, next) => {
|
||||
try {
|
||||
await next();
|
||||
}
|
||||
catch (err) {
|
||||
console.log(err);
|
||||
if (isHttpError(err)) {
|
||||
ctx.response.status = err.status;
|
||||
const { message, status, stack } = err;
|
||||
ctx.response.body = { message, status, stack };
|
||||
}
|
||||
else {
|
||||
throw err;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
|
||||
//app.use(async (ctx, next) => {
|
||||
// ctx.throw(404);
|
||||
// //ctx.response.status = 404;
|
||||
// //ctx.response.body = "Not Found";
|
||||
// //await next();
|
||||
//});
|
||||
|
2
gitea.ts
2
gitea.ts
@ -43,7 +43,7 @@ export async function getRepositoryContent(owner:string,
|
||||
}
|
||||
|
||||
if (import.meta.main) {
|
||||
const results = await searchRepositoryWithTopic("deno");
|
||||
const results = await searchRepositoryWithTopic("denolib");
|
||||
console.log(results.data?.map((repo) => repo.full_name));
|
||||
const s = await getRepositoryContent("monoid", "script", "", "");
|
||||
console.log((s as ContentsResponse[]).map((x) => x.name));
|
||||
|
Loading…
Reference in New Issue
Block a user