feat(server): Add basePath config to host from a directory (#2092)
Co-authored-by: Marvin Hagemeister <marvin@deno.com>
This commit is contained in:
co-authored by
Marvin Hagemeister
parent
fe792455ab
commit
9ab8651018
@@ -0,0 +1,9 @@
|
||||
import { Handlers } from "$fresh/server.ts";
|
||||
|
||||
export const handler: Handlers<unknown, { data: string }> = {
|
||||
GET(_req, ctx) {
|
||||
return new Response(ctx.basePath, {
|
||||
status: 200,
|
||||
});
|
||||
},
|
||||
};
|
||||
@@ -0,0 +1,7 @@
|
||||
import { Handlers } from "$fresh/server.ts";
|
||||
|
||||
export const handler: Handlers<unknown, { data: string }> = {
|
||||
GET(_req, ctx) {
|
||||
return new Response(ctx.state.data);
|
||||
},
|
||||
};
|
||||
@@ -0,0 +1,13 @@
|
||||
import { Handlers } from "$fresh/server.ts";
|
||||
|
||||
export const handler: Handlers<unknown, { data: string }> = {
|
||||
GET(req) {
|
||||
const url = new URL(req.url);
|
||||
return new Response(null, {
|
||||
status: 302,
|
||||
headers: {
|
||||
"Location": url.origin,
|
||||
},
|
||||
});
|
||||
},
|
||||
};
|
||||
Reference in New Issue
Block a user