GeezerVisonThe World Wide Web, restored to 800 pixels of glory. |
| Home|About|Gaming cabinet|Archives|How it works|Starter sites |
GeezerVison is showing github.com — Update eject example to something more robust · Issue #616 · fastify/fastify-cli Open DescriptionPrerequisites
🚀 Feature ProposalChange the eject file example to validate everything before running the server and make use of the MotivationWhat made me think of this approach are:
Example// Read the .env file. import * as dotenv from "dotenv"; dotenv.config(); // Require the framework import Fastify from "fastify"; // Require library to exit fastify process, gracefully (if possible) import closeWithGrace from "close-with-grace"; // Instantiate Fastify with some config const app = Fastify({ logger: true, }); // make use of the `.ready()` to prevent going on race condition fastify.register(app).ready((err) => { // throw error if something happened on registering `plugins` or `routes` if (err) throw err; // delay is the number of milliseconds for the graceful close to finish const closeListeners = closeWithGrace( { delay: parseInt(process.env.FASTIFY_CLOSE_GRACE_DELAY as string) || 500, }, async function ({ signal, err, manual }) { if (err) { fastify.log.error(err); } await fastify.close(); } as closeWithGrace.CloseWithGraceAsyncCallback ); fastify.addHook("onClose", async (instance, done) => { closeListeners.uninstall(); done(); }); //server listen const port = process.env.PORT || 8000; // Start listening. fastify.listen({ port: parseInt(port as string) }, (err: any) => { if (err) { fastify.log.error(err); process.exit(1); } }); }); Activity
MetadataMetadataAssigneesLabelsNo labels TypeProjectsMilestoneRelationshipsDevelopmentIssue actions |
| You are visitor 01402775 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |