Giter Site home page Giter Site logo

microsoftdocs / node-essentials Goto Github PK

View Code? Open in Web Editor NEW
105.0 19.0 146.0 845 KB

MS Learn Node Essentials sample code

Home Page: https://learn.microsoft.com/training/paths/build-javascript-applications-nodejs/

License: Creative Commons Attribution 4.0 International

Shell 1.92% JavaScript 98.08%
azure javascript microsoft-learn nodejs npm tutorial tutorial-exercises

node-essentials's Issues

Best practice for updates

Is this correct?

The recommended workflow for updates is:

  1. Verify your existing tests pass before starting this update process.
  2. npm audit: to check for vulnerabilities in the current version you are using.
  3. npm outdated: to list all the outdated packages. This command provides information in the Wanted, Latest, and Location columns.
  4. The information from npm audit may recommend updating to a major version. You should carefully review the breaking changes if any are listed.
  5. Update the version:
    • npm update <optional package name>: to update the installed packages. If you run this command with a package name specified, the command tries to update only the specified package. If you don't specify a package, the command tries to update all the packages in the package.json file.
    • npm audit fix --force: this command updates the major version of the package. This command can introduce breaking changes. Use this command only if you're aware of the breaking changes and are ready to update your code to accommodate them.
  6. Verify your tests pass after the update.

Missing `client-delete-route.js` from repo

In step 5 of the Route management lesson there is a reference to 'client-delete-route.js'. This file does not appear to exist within the repo which makes it impossible to complete the tasks on that step.

Here is the page that has the reference:

https://docs.microsoft.com/en-us/learn/modules/build-web-api-nodejs-express/5-exercise-route-management

And the path to where the file should exist:

/node-essentials/node-dependencies/8-express-app/node-essentials/nodejs-http/exercise-express-routing/reading-writing/client-delete-route.js

Typo in NodeJS course

Hi,
I wanted to let you know there is a typo in the file system module, unit 3 where a function name is mistyped in step 3 of "Write a method to find the sales.json files"

It is written as

This new method findFiles is created inside the main findSalesMethod method so that it can run as many times as necessary to find all the sales files and populate the salesFiles array. The folderName value is the path to the current folder.

Instead it should be

This new method findFiles is created inside the main findSalesFiles method so that it can run as many times as necessary to find all the sales files and populate the salesFiles array. The folderName value is the path to the current folder.

Loom video link

File System example error

Code provided raises the following syntax error:

const items = await fs.readdir("stores");
              ^^^^^

SyntaxError: await is only valid in async functions and the top level bodies of modules

Code:

const fs = require("fs").promises;

const items = await fs.readdir("stores");
console.log(items);

Incorrect path.join in learning material

Typos at unit 6 Create files and directories at Work with files and directories in a Node.js app in learning material.

The Create files section is wrong. The example code says that the 3rd argument of path.join is the content of the file to be written to. That makes no sense as is incorrect. The text in the section that explains the core are incorrect too.
Example: await fs.writeFile(path.join(__dirname, "greeting.txt", "Hello World!"));
Should have been: await fs.writeFile(path.join(__dirname, "greeting.txt"), "Hello World!");

Trying to run the incorrect example code gives the following error:

TypeError [ERR_INVALID_ARG_TYPE]: The "data" argument must be of type string or an instance of Buffer, TypedArray, or DataView. Received undefined
    at Object.writeFile (node:internal/fs/promises:812:5)

Recommended code for exercise doesn't work

The code provided for app.delete on Exercise - Route management -> Implement support for reading and writing data -> 7. will not work with the files provided. Recommend changing to:

app.delete('/products', function(req, res) {
  const deletedProduct = products.find(p => p.id === +req.body.id);
  products = products.filter(p => p.id !== +req.body.id);
  res.json(deletedProduct);
});

Incorrect command "node.index.js" in learning material

Typos at unit 9 Exercise - Read and write to files at Work with files and directories in a Node.js app in learning material.

The Run the program section is wrong. Step 2 says to run the index.js file again, but the command is changed to node.index.js.
That should have been node index.js again as in step 1.

Trying to execute the incorrect commands gives the following error:
node.index.js : The term 'node.index.js' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and
try again.
At line:1 char:1

  • node.index.js
  •   + CategoryInfo          : ObjectNotFound: (node.index.js:String) [], CommandNotFoundException
      + FullyQualifiedErrorId : CommandNotFoundException
    
    

Also step 3 Select the index.js file makes no sense.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.