Compare commits
No commits in common. "8a67f4fbdbbabe9d8f8b2e9baba1df92e415a9c4" and "750c81f4cb3d23e3f479e1514e1a280af39c3aa3" have entirely different histories.
8a67f4fbdb
...
750c81f4cb
22
app.ts
22
app.ts
@ -1,4 +1,4 @@
|
|||||||
import { Application, Router, isHttpError } from "https://deno.land/x/oak@v12.1.0/mod.ts";
|
import { Application, Router, HttpError, isHttpError } from "https://deno.land/x/oak@v12.1.0/mod.ts";
|
||||||
import {
|
import {
|
||||||
searchRepositoryWithTopic,
|
searchRepositoryWithTopic,
|
||||||
getRepositoryTags,
|
getRepositoryTags,
|
||||||
@ -156,27 +156,9 @@ app.use(async (ctx, next) => {
|
|||||||
app.use(router.routes());
|
app.use(router.routes());
|
||||||
app.use(router.allowedMethods());
|
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) => {
|
//app.use(async (ctx, next) => {
|
||||||
// ctx.throw(404);
|
// ctx.throw(404);
|
||||||
|
// //ctx.response.status = 404;
|
||||||
// //ctx.response.body = "Not Found";
|
// //ctx.response.body = "Not Found";
|
||||||
// //await next();
|
// //await next();
|
||||||
//});
|
//});
|
||||||
|
2
gitea.ts
2
gitea.ts
@ -43,7 +43,7 @@ export async function getRepositoryContent(owner:string,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (import.meta.main) {
|
if (import.meta.main) {
|
||||||
const results = await searchRepositoryWithTopic("denolib");
|
const results = await searchRepositoryWithTopic("deno");
|
||||||
console.log(results.data?.map((repo) => repo.full_name));
|
console.log(results.data?.map((repo) => repo.full_name));
|
||||||
const s = await getRepositoryContent("monoid", "script", "", "");
|
const s = await getRepositoryContent("monoid", "script", "", "");
|
||||||
console.log((s as ContentsResponse[]).map((x) => x.name));
|
console.log((s as ContentsResponse[]).map((x) => x.name));
|
||||||
|
Loading…
Reference in New Issue
Block a user