nodejs.dev icon indicating copy to clipboard operation
nodejs.dev copied to clipboard

chore(docs): remove express code examples

Open araujogui opened this issue 3 years ago • 6 comments

Check List

  • [x] I have read the Contributing Guidelines and made commit messages that follow the guideline.
  • [x] I have run npm run lint:js -- --fix and/or npm run lint:md -- --fix for my JavaScript and/or Markdown changes.
    • This is important as most of the cases your code changes might not be correctly linted
  • [x] I have run npm run test to check if all tests are passing, and/or npm run test -- -u to update snapshots if I created and/or updated React Components.
  • [x] I have checked that the build works locally and that npm run build and npm run build-storybook work fine.
  • [x] I've covered new added functionality with unit tests if necessary.

Description

Remove express.js code examples from "How to exit from a Node.js program" and "Get HTTP request body data using Node.js".

Related Issues

Fixes #1584

araujogui avatar Aug 04 '22 15:08 araujogui

Codecov Report

Merging #2615 (9c04111) into main (1b08e05) will not change coverage. The diff coverage is n/a.

@@           Coverage Diff           @@
##             main    #2615   +/-   ##
=======================================
  Coverage   87.47%   87.47%           
=======================================
  Files          87       87           
  Lines        1006     1006           
  Branches      272      272           
=======================================
  Hits          880      880           
  Misses        120      120           
  Partials        6        6           

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

codecov-commenter avatar Aug 04 '22 16:08 codecov-commenter

I don't think this should be removed.

Why? express.js is probably the most popular way of creating APIs with node.js

benhalverson avatar Aug 05 '22 03:08 benhalverson

express.js is probably the most popular way of creating APIs with node.js

Being agnostic on the examples with pure Node.js would be an unbiased way of giving examples, but that doesn't mean we could also add express.js examples and other framework examples.

E.g., alongside the node.js http ones, we could add a code snippet example for express.js and fastify. On the node-request-data doc. The node-terminate-program happens to use an http program, but it could use just a plain `while´ loop as that doc explains how gracefully kill node.js programs.

ovflowd avatar Aug 05 '22 08:08 ovflowd

@araujogui could you rebase the PR and update the branch with the requested changes?

ovflowd avatar Aug 12 '22 14:08 ovflowd

express.js is probably the most popular way of creating APIs with node.js

Being agnostic on the examples with pure Node.js would be an unbiased way of giving examples, but that doesn't mean we could also add express.js examples and other framework examples.

E.g., alongside the node.js http ones, we could add a code snippet example for express.js and fastify. On the node-request-data doc. The node-terminate-program happens to use an http program, but it could use just a plain `while´ loop as that doc explains how gracefully kill node.js programs.

In node-terminate-program, I think the HTTP server example would be more common and useful in the real world and illustrate better the importance of a graceful shutdown.

A loop example feels too generic to me and it doesn't self-explain well why should you care about graceful shutdowns

const timer = setInterval(() => {
  console.log("Hello, loops!");
}, 1000);

process.on("SIGTERM", () => {
  console.log("Received SIGTERM signal");
  clearInterval(timer);
});

araujogui avatar Aug 16 '22 21:08 araujogui

This pull request is stale because it has been open for 30 days with no activity.

github-actions[bot] avatar Sep 16 '22 02:09 github-actions[bot]

This pull request was closed because it has been inactive for 14 days since being marked as stale.

github-actions[bot] avatar Oct 01 '22 02:10 github-actions[bot]