Created
April 26, 2023 15:45
-
-
Save arqex/64dfedbf8872b889a69c3f293de835a4 to your computer and use it in GitHub Desktop.
Desplegar Dapp en Arweave usando deno
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { serve } from "https://deno.land/[email protected]/http/server.ts"; | |
// Sustituye este enlace por el que devuelve el despliegue de tu aplicación | |
// con arkb | |
const fileService = "https://arweave.net/RhfPbeXFU3ieGVS5qALEnrIqeHNyeOiYnnVsmI04pPg"; | |
async function reqHanlder( req: Request ) { | |
let path = new URL(req.url).pathname; | |
if( path === '/faq' ){ | |
path = '/'; | |
} | |
return await fetch( fileService + path ).then( res => { | |
const headers = new Headers(res.headers); | |
headers.set('cache-control', 's-max-age=600, stale-while-revalidate=60000') | |
return new Response(res.body, { | |
status: res.status, | |
headers | |
}); | |
}); | |
} | |
serve(reqHanlder, {port: 8100}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment