Request error with Oak
See original GitHub issueI’m trying to implement Aleph into an existing Oak server but am blocked by react.development.js requests coming back invalid.
import { Application as Oak } from "https://deno.land/x/oak/mod.ts";
import { Application, Server } from "https://deno.land/x/aleph/server/mod.ts";
import { localProxy } from "https://deno.land/x/aleph/server/localproxy.ts";
import { serve } from "https://deno.land/std@0.91.0/http/server.ts";
localProxy(8080);
const port = 1337;
const hostname = "localhost";
const oak = new Oak();
const app = new Application(".", "development", false);
const server = new Server(app);
oak.use(async (ctx) => {
await server.handle(ctx.request.serverRequest as any);
});
await oak.listen({ port });
//let s = serve({ port, hostname });
//for await (const r of s) {
// server.handle(r as any);
//}
Looks like the full file isn’t being returned for some reason.
Oak on top, std on bottom
Issue Analytics
- State:
- Created 2 years ago
- Comments:16 (11 by maintainers)
Top Results From Across the Web
Crash while trying to resolve the request body #410 - GitHub
I solved it! The error wasn't caused by oak but by the order of middleware. Before, causing error: app.
Read more >Frequently Asked Questions | oak - GitHub Pages
Specifically error messages like Http - connection closed before message completed can occur when responding to requests where the connection drops before Deno ......
Read more >Deno Oak middleware to handle all errors | The JS runtimes
A middleware error handler would catch all the errors raised by the Oak framework / application code. It'd then respond to the client...
Read more >Deno oak v10.5.1 context.cookies never being set
When attempting to set cookies in oak, the cookies property of the context is never changed and the value is always returned undefined...
Read more >oak@v5.2.0 - Deno
Currently oak supports request body types of JSON, text and URL encoded form data. ... the request will be rejected with a 415...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@aadamsx The /api directory is for serverless functions, like NextJS
@aadamsx So, we are probably going to support having Aleph for full stack - but it is much more performant and organized to seperate the frontend and the backend. That allows you to modify them seperately without getting bogged down on tooling that combines then and since the frontend would either use static files or serverless functions which are fast, the frontend would be fast and not limited by the overhead of serving static files with a normal server.