Skip to content

Instantly share code, notes, and snippets.

@arqex
Created April 26, 2023 15:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save arqex/64dfedbf8872b889a69c3f293de835a4 to your computer and use it in GitHub Desktop.
Save arqex/64dfedbf8872b889a69c3f293de835a4 to your computer and use it in GitHub Desktop.
Desplegar Dapp en Arweave usando deno
import { serve } from "https://deno.land/std@0.155.0/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