Bairdy
Bairdy
DDeno
Created by Bairdy on 1/14/2024 in #help
Can Deno list all functions within a script without explicit registration or annotation?
Apparently deno doc is a command that does something very similar. Searching for the wrong keywords I guess
4 replies
DDeno
Created by begoon on 8/31/2023 in #help
Outgoing connection over TLS (port 465) from the deno deployment is failing
It is very likely Deno Deploy has implemented Spam Guard for folks with similar goals as yours. Also, Deno Mailer - GitHub Issue #72 describes the developer having issues implementing "STARTTLS is currently broken..." and recommends using version 1.4.0. Most recently version 1.6.0 - STARTTLS fix was released, that being 7 months ago.
10 replies
DDeno
Created by Bairdy on 8/6/2023 in #help
Deno.serve AbortController onError. How?
Scenario #2 * Once started, the server runs until the first error is thrown by the route handlers. * onError, the abort signal is sent to the AbortController. * The abort signal needs to be passed as the signal option in the options bag.
const ac = new AbortController();

const server = Deno.serve({
// The port to listen on.
port: config.http.server.port,
// A literal IP address or host name that can be resolved to an IP address.
hostname: "0.0.0.0",
// An AbortSignal to close the server and all connections.
signal: ac.signal,
// The callback which is called when the server starts listening.
onListen({ port, hostname }) {
// console.log(`Server started at http://${hostname}:${port}`);
console.log(
`%cApplication..... fsrv v2.0 - A Deno HTTP Server
Deno v${Deno.version.deno} : Typescript v${Deno.version.typescript} : V8 v${Deno.version.v8}
Gateway URL..... http://${hostname}:${port}
Server Root..... ${config.http.server.www}
Internal Pages.. ${config.http.server.internal}
Site Root....... ${config.http.server.public}`,
"color: #7986cb",
);
},
// The handler to invoke when route handlers throw an error.
onError(error: unknown) {
console.error(error);
log("HTTP 500");

// FATAL ERROR!

// The server aborts when the abort signal is sent to the abort controller.
console.log("Closing server...");

// Send the abort signal!
ac.abort("Stream aborted");

// To wait for the server to close, await the promise returned from the Deno.serve API.
server.finished.then(() => console.log("Server closed"));

/**
* onError needs a return value or error Type 'void' is not assignable
* to type 'Response | Promise<Response>' occurs.
*
* return here is NEVER reached because of the ac.abort() call that preceeds it.
*
*/
return new Response("Stream aborted");

},
}, handler); // <-- The handler goes here
const ac = new AbortController();

const server = Deno.serve({
// The port to listen on.
port: config.http.server.port,
// A literal IP address or host name that can be resolved to an IP address.
hostname: "0.0.0.0",
// An AbortSignal to close the server and all connections.
signal: ac.signal,
// The callback which is called when the server starts listening.
onListen({ port, hostname }) {
// console.log(`Server started at http://${hostname}:${port}`);
console.log(
`%cApplication..... fsrv v2.0 - A Deno HTTP Server
Deno v${Deno.version.deno} : Typescript v${Deno.version.typescript} : V8 v${Deno.version.v8}
Gateway URL..... http://${hostname}:${port}
Server Root..... ${config.http.server.www}
Internal Pages.. ${config.http.server.internal}
Site Root....... ${config.http.server.public}`,
"color: #7986cb",
);
},
// The handler to invoke when route handlers throw an error.
onError(error: unknown) {
console.error(error);
log("HTTP 500");

// FATAL ERROR!

// The server aborts when the abort signal is sent to the abort controller.
console.log("Closing server...");

// Send the abort signal!
ac.abort("Stream aborted");

// To wait for the server to close, await the promise returned from the Deno.serve API.
server.finished.then(() => console.log("Server closed"));

/**
* onError needs a return value or error Type 'void' is not assignable
* to type 'Response | Promise<Response>' occurs.
*
* return here is NEVER reached because of the ac.abort() call that preceeds it.
*
*/
return new Response("Stream aborted");

},
}, handler); // <-- The handler goes here
6 replies
DDeno
Created by Bairdy on 8/6/2023 in #help
Deno.serve AbortController onError. How?
Scenario #1 * Once started, the server runs regardless of encountering route handler errors. * onError, a warning HTTP 500 response is still returned to the client. * There is no Abort Controller.
Deno.serve({
// The port to listen on.
port: config.http.server.port,
// A literal IP address or host name that can be resolved to an IP address.
hostname: "0.0.0.0",
// The callback which is called when the server starts listening.
onListen({ port, hostname }) {
console.log(
`%cApplication..... fsrv v2.0 - A Deno HTTP Server
Deno v${Deno.version.deno} : Typescript v${Deno.version.typescript} : V8 v${Deno.version.v8}
Permissions: --allow-sys --allow-read --allow-net
Gateway URL..... http://${hostname}:${port}
Server Root..... ${config.http.server.www}
Internal Pages.. ${config.http.server.internal}
Site Root....... ${config.http.server.public}\n\n`,
"color: #7986cb",
);
},
// The handler to invoke when route handlers throw an error.
onError(error: unknown) {
console.error(error);
console.log("HTTP 500");

// WARNING!

/**
* onError returns HTTP response.
* Server proceeds to next request.
*
*/
return serverResponse(
"HTTP 500: Internal Server Error",
500,
"text/plain",
);

},
}, handler); // <-- The handler goes here
Deno.serve({
// The port to listen on.
port: config.http.server.port,
// A literal IP address or host name that can be resolved to an IP address.
hostname: "0.0.0.0",
// The callback which is called when the server starts listening.
onListen({ port, hostname }) {
console.log(
`%cApplication..... fsrv v2.0 - A Deno HTTP Server
Deno v${Deno.version.deno} : Typescript v${Deno.version.typescript} : V8 v${Deno.version.v8}
Permissions: --allow-sys --allow-read --allow-net
Gateway URL..... http://${hostname}:${port}
Server Root..... ${config.http.server.www}
Internal Pages.. ${config.http.server.internal}
Site Root....... ${config.http.server.public}\n\n`,
"color: #7986cb",
);
},
// The handler to invoke when route handlers throw an error.
onError(error: unknown) {
console.error(error);
console.log("HTTP 500");

// WARNING!

/**
* onError returns HTTP response.
* Server proceeds to next request.
*
*/
return serverResponse(
"HTTP 500: Internal Server Error",
500,
"text/plain",
);

},
}, handler); // <-- The handler goes here
6 replies
DDeno
Created by Bairdy on 8/6/2023 in #help
Deno.serve AbortController onError. How?
Thank you both for such simple solutions. I now have 2 working example scenarios.
6 replies
DDeno
Created by Bairdy on 6/22/2023 in #help
Is anyone working on LLMs for Deno so I don't have to learn it in disgusting Python?
Amazing! Thanks for the tip!
6 replies
DDeno
Created by Bairdy on 3/24/2023 in #help
VScode deno lint blew up again after update.
3.14 still works.
2 replies
DDeno
Created by Bairdy on 3/4/2023 in #help
Feature Suggestion: Dark Mode for `std` library Docs.
Thank you for the useful replies! I certainly understand this is not a priority is the grand scheme of things. Just wondered if Tailwinds could allow for a relatively small update that propagates to all pages.
8 replies
DDeno
Created by Bairdy on 2/25/2023 in #help
Remove std/node, it was merged into Deno itself (#3206)
Thank you!
22 replies
DDeno
Created by Bairdy on 2/25/2023 in #help
Remove std/node, it was merged into Deno itself (#3206)
No node. Imagine node doesn't exist right now and answer my question
22 replies
DDeno
Created by Bairdy on 2/25/2023 in #help
Remove std/node, it was merged into Deno itself (#3206)
Hope I made sense this time
22 replies
DDeno
Created by Bairdy on 2/25/2023 in #help
Remove std/node, it was merged into Deno itself (#3206)
Ok. I don't like NODE. I will never use if I don't have to. Now that you know this, can you answer me if deno has these 2 libraries as pure deno code. not polyfil node code
22 replies
DDeno
Created by Bairdy on 2/25/2023 in #help
Remove std/node, it was merged into Deno itself (#3206)
Can I find them in API reference? That what I'm asking
22 replies
DDeno
Created by Bairdy on 2/25/2023 in #help
Remove std/node, it was merged into Deno itself (#3206)
I am referring to these. Does deno have these built in import { inflate } from "node:zlib"; import { Buffer } from "node:buffer";
22 replies
DDeno
Created by Bairdy on 2/25/2023 in #help
Remove std/node, it was merged into Deno itself (#3206)
Or only the node way?
22 replies
DDeno
Created by Bairdy on 2/25/2023 in #help
Remove std/node, it was merged into Deno itself (#3206)
I mean, does deno do this directly but also offers a node way to do it?
22 replies
DDeno
Created by Bairdy on 2/25/2023 in #help
Remove std/node, it was merged into Deno itself (#3206)
So currently, deno does not have a way to do this without node correct?
22 replies