Skip to content

Commit

Permalink
fix the styling for Node.js (#6628)
Browse files Browse the repository at this point in the history
  • Loading branch information
Rajakavitha1 authored Sep 26, 2023
1 parent df05efa commit fb2ead7
Show file tree
Hide file tree
Showing 7 changed files with 38 additions and 38 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
slug: getting-started-with-nodejs-sqlite
description: 'With npm and sqlite3, you can make your NodeJS applications shine. This guide explains how you can install NodeJS SQLite, create a SQLite database, create tables, and insert data.'
description: 'With npm and sqlite3, you can make your Node.js applications shine. This guide explains how you can install Node.js SQLite, create a SQLite database, create tables, and insert data.'
keywords: ['nodejs sqlite']
tags: ['nodejs', 'sqlite', 'database']
license: '[CC BY-ND 4.0](https://creativecommons.org/licenses/by-nd/4.0)'
Expand All @@ -9,8 +9,8 @@ modified: 2022-01-14
image: NodeSQLite.jpg
modified_by:
name: Linode
title: "Getting Started with NodeJS SQLite"
title_meta: "NodeJS SQLite3: A Beginner's Guide to Installation & Usage"
title: "Getting Started with Node.js SQLite"
title_meta: "Node.js SQLite3: A Beginner's Guide to Installation & Usage"
external_resources:
- '[SQLite3 API](https://github.com/mapbox/node-sqlite3/wiki/API)'
- '[Marvel Cinematic Universe](https://www.marvel.com/movies)'
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
slug: how-to-install-and-use-deno
title: "Install and Use the Deno Javascript Runtime (Node.JS Alternative)"
title: "Install and Use the Deno Javascript Runtime (Node.js Alternative)"
description: 'This guide introduces the Deno JavaScript runtime and compares it to Node.js. It also explains how to install and use Deno.'
keywords: ['what is Deno', 'Deno vs Node.js', 'install Deno', 'how to use Deno']
license: '[CC BY-ND 4.0](https://creativecommons.org/licenses/by-nd/4.0)'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
slug: build-react-video-streaming-app
description: "Learn how to build streaming software with two components: one for streaming videos and generating thumbnails, and the other for listing/playing them."
og_description: "Learn how to build a video streaming application with two components: a server-side Node.js application that will stream videos and generate video thumbnails, and a client application in React that will list and play the videos."
keywords: ['React','Nodejs','Video streaming', "video captions", "video thumbnails"]
keywords: ['React','Node.js','Video streaming', "video captions", "video thumbnails"]
license: '[CC BY-ND 4.0](https://creativecommons.org/licenses/by-nd/4.0)'
published: 2020-08-09
modified_by:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ title_meta: "How to Create a MERN Stack on Linux"
external_resources:
- '[How to Use MERN Stack: A Complete Guide](https://www.mongodb.com/languages/mern-stack-tutorial)'
- '[The MERN stack: A complete tutorial](https://blog.logrocket.com/mern-stack-tutorial/)'
- '[Learn the MERN Stack - Full Tutorial for Beginners (MongoDB, Express, React, NodeJS) in 12Hrs (2021)](https://www.youtube.com/watch?v=7CqJlxBYj-M)'
- '[Learn the MERN Stack - Full Tutorial for Beginners (MongoDB, Express, React, Node.js) in 12Hrs (2021)](https://www.youtube.com/watch?v=7CqJlxBYj-M)'
- '[Learn the MERN Stack - Full Tutorial (MongoDB, Express, React, Node.js)](https://www.youtube.com/watch?v=7CqJlxBYj-M)'
authors: ["Cameron Laird"]
---
Expand Down
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
---
slug: install-nodejs-on-ubuntu-22-04
description: 'You need to know how to install Node.JS on Ubuntu 22.04 Linux if you work on a cloud server with cloud apps. This tutorial gets you started? ✓ Click here!'
keywords: ['Install Node.JS on Ubuntu 22.04','Node.JS','Node.JS Ubuntu 22.04','Ubuntu 22.04 Node.JS','Install Node.JS Linux']
keywords: ['Install Node.js on Ubuntu 22.04','Node.js','Node.js Ubuntu 22.04','Ubuntu 22.04 Node.js','Install Node.js Linux']
license: '[CC BY-ND 4.0](https://creativecommons.org/licenses/by-nd/4.0)'
published: 2023-02-24
modified_by:
name: Linode
title: "How to Install Node.JS on Ubuntu 22.04"
title_meta: "Installing Node.JS on Ubuntu 22.04"
title: "How to Install Node.js on Ubuntu 22.04"
title_meta: "Installing Node.js on Ubuntu 22.04"
external_resources:
- '[Installati.one: How To Install node-security on Ubuntu 22.04](https://installati.one/ubuntu/22.04/node-security/)'
authors: ["John Mueller"]
---

Developers use [Node.JS](https://nodejs.org/) to perform [many tasks](https://nodejs.org/en/about/). It's used to install other applications, run server-side code, and execute JavaScript for user environments such as web applications. This guide shows you how to install Node.JS on Ubuntu 22.04.
Developers use [Node.js](https://nodejs.org/) to perform [many tasks](https://nodejs.org/en/about/). It's used to install other applications, run server-side code, and execute JavaScript for user environments such as web applications. This guide shows you how to install Node.js on Ubuntu 22.04.

## Before You Begin

Expand All @@ -25,36 +25,36 @@ Developers use [Node.JS](https://nodejs.org/) to perform [many tasks](https://no
This guide is written for a non-root user. Commands that require elevated privileges are prefixed with `sudo`. If you’re not familiar with the `sudo` command, see the [Users and Groups](/docs/guides/linux-users-and-groups/) guide.
{{< /note >}}

## Installing Node.JS
## Installing Node.js

There are a number of options to configure Ubuntu 22.04 for Node.JS. These sections discuss the three most popular techniques.
There are a number of options to configure Ubuntu 22.04 for Node.js. These sections discuss the three most popular techniques.

### Installing Node.JS from the Default Repositories
### Installing Node.js from the Default Repositories

The following steps show the simplest method to get the current Node.JS implementation for Ubuntu 22.04 using the default repositories.
The following steps show the simplest method to get the current Node.js implementation for Ubuntu 22.04 using the default repositories.

1. Install Node.JS:
1. Install Node.js:

```command
sudo apt install -y nodejs
```

1. Once the install is complete, verify your Node.JS installation:
1. Once the install is complete, verify your Node.js installation:

```command
node -v
```

This information is important, as you may need a different version of Node.JS to perform a particular task.
This information is important, as you may need a different version of Node.js to perform a particular task.

1. **Optional:** Enter the following command to install the [Node Package Manager (NPM)](https://www.npmjs.com/), which provides additional flexibility for Node.JS management:
1. **Optional:** Enter the following command to install the [Node Package Manager (NPM)](https://www.npmjs.com/), which provides additional flexibility for Node.js management:

```command
sudo apt install -y npm
```

{{< note >}}
Some scripts also rely on NPM to verify Node.JS features or perform other tasks.
Some scripts also rely on NPM to verify Node.js features or perform other tasks.
{{< /note >}}

1. **Optional:** Verify your NPM version:
Expand All @@ -65,15 +65,15 @@ The following steps show the simplest method to get the current Node.JS implemen

### Installing a Specific Version

A task may require a specific version of Node.JS. The example steps below show how to install the most current Node.JS version 16.x setup. However, the `16` in can be replaced with any other major supported version, including `19` (also `current`), `18` (also `lts`), or `14`.
A task may require a specific version of Node.js. The example steps below show how to install the most current Node.js version 16.x setup. However, the `16` in can be replaced with any other major supported version, including `19` (also `current`), `18` (also `lts`), or `14`.

1. Obtain the Node.JS source:
1. Obtain the Node.js source:

```command
curl -sL https://deb.nodesource.com/setup_16.x | sudo -E bash -
```

1. Install the 16.x version of Node.JS:
1. Install the 16.x version of Node.js:

```command
sudo apt-get install -y nodejs
Expand All @@ -83,7 +83,7 @@ A task may require a specific version of Node.JS. The example steps below show h
This process also automatically installs NPM.
{{< /note >}}

1. Verify that the correct version of Node.JS is installed:
1. Verify that the correct version of Node.js is installed:

```command
node -v
Expand All @@ -105,23 +105,23 @@ A task may require a specific version of Node.JS. The example steps below show h

The output should display version `9.5.1` or above.

### Node.JS for Developers
### Node.js for Developers

The Node Version Manager supports multiple versions of Node.JS on a single system. This is so it can test scripts using multiple Node.JS versions. You can find the procedure for working with NVM [here](/docs/guides/how-to-install-use-node-version-manager-nvm/).
The Node Version Manager supports multiple versions of Node.js on a single system. This is so it can test scripts using multiple Node.js versions. You can find the procedure for working with NVM [here](/docs/guides/how-to-install-use-node-version-manager-nvm/).

## Securing Node.JS
## Securing Node.js

Node.JS provides a powerful scripting engine that could be misused by others. Installing Node.JS without following best practices is an open invitation to hackers. This list provides basic steps you can use to make your instance of Node.JS more secure:
Node.js provides a powerful scripting engine that could be misused by others. Installing Node.js without following best practices is an open invitation to hackers. This list provides basic steps you can use to make your instance of Node.js more secure:

- **Do not run Node.JS as the root user**: Assume that a hacker gains access to your system. Running code as the root user means the hacker has a valuable resource to break everything else down. Instead, run Node.JS with only the rights needed for the specific application in question.
- **Do not run Node.js as the root user**: Assume that a hacker gains access to your system. Running code as the root user means the hacker has a valuable resource to break everything else down. Instead, run Node.js with only the rights needed for the specific application in question.

- **Use strong authentication**: The first line of defense for your application is to ensure that the user is not a hacker. The best practice is to use a tool such as [Okta](https://developer.okta.com/) or [OAuth](https://auth0.com/) for authentication.

- **Use a reverse proxy**: A [reverse proxy](https://medium.com/intrinsic-blog/why-should-i-use-a-reverse-proxy-if-node-js-is-production-ready-5a079408b2ca) is a specialized kind of web server that makes it possible to do things like limit the number of requests a Node.JS application can receive. Basically, the reverse proxy receives the user request, vets it to ensure the request is valid, and only then passes it to the Node.JS application.
- **Use a reverse proxy**: A [reverse proxy](https://medium.com/intrinsic-blog/why-should-i-use-a-reverse-proxy-if-node-js-is-production-ready-5a079408b2ca) is a specialized kind of web server that makes it possible to do things like limit the number of requests a Node.js application can receive. Basically, the reverse proxy receives the user request, vets it to ensure the request is valid, and only then passes it to the Node.js application.

- **Set package access levels**: One of the reasons to install a package manager like NPM [is to control](https://docs.npmjs.com/cli/v6/commands/npm-access) who can access packages and how they do so. In fact, NPM comes with a [wealth of commands](https://docs.npmjs.com/cli/v6/commands).

- **Validate user inputs**: Node.JS is vulnerable to [injection-based attacks](https://www.stackhawk.com/blog/nodejs-command-injection-examples-and-prevention/), so it’s essential to verify that the user is sending data, and not an executable script.
- **Validate user inputs**: Node.js is vulnerable to [injection-based attacks](https://www.stackhawk.com/blog/nodejs-command-injection-examples-and-prevention/), so it’s essential to verify that the user is sending data, and not an executable script.

- **Keep secrets secret**: Storing sensitive information like database connection strings and API keys in code is a bad idea. Using a specially configured library like [dotenv](https://www.npmjs.com/package/dotenv) makes it possible to load and store environment variables in a secure manner.

Expand All @@ -133,9 +133,9 @@ Node.JS provides a powerful scripting engine that could be misused by others. In

- **Check code using a security linter**: A [linter](https://www.testim.io/blog/what-is-a-linter-heres-a-definition-and-quick-start-guide/) is an essential tool that helps improve code. A [security linter](https://geekflare.com/nodejs-security-scanner/) specifically looks for security issues in code. A security linter helps locate the vast majority of security issues. There is no guarantee that a hacker won’t find another way in, so use the other methods in this list as well to secure your application.

## Starting, Stopping, and Restarting Node.JS on Ubuntu 22.04
## Starting, Stopping, and Restarting Node.js on Ubuntu 22.04

Working with Node.JS is easier when NPM is installed. Here are some useful commands to interact with installed packages:
Working with Node.js is easier when NPM is installed. Here are some useful commands to interact with installed packages:

- `npm ls`: List the installed packages to determine if you need to install a package before you run it.

Expand All @@ -149,7 +149,7 @@ Working with Node.JS is easier when NPM is installed. Here are some useful comma

NPM commands are the best way to manage scripts and packages and there are several to help do so.

Should a rogue process not work correctly with NPM or Node.JS, there is a three-stop process to stop it:
Should a rogue process not work correctly with NPM or Node.js, there is a three-stop process to stop it:

1. List all of the running node processes:

Expand Down Expand Up @@ -177,9 +177,9 @@ Should a rogue process not work correctly with NPM or Node.JS, there is a three-
```
{{< /note >}}
## Removing Node.JS
## Removing Node.js
To remove the current version of Node.JS (and NPM, if installed), enter the following command:
To remove the current version of Node.js (and NPM, if installed), enter the following command:
```command
sudo apt remove -y nodejs
Expand All @@ -195,4 +195,4 @@ sudo apt remove -y npm
## Conclusion
Node.JS has a lot to offer in running server-side code. When paired with a package manager, it's an unbeatable combination that makes the work of both administrators and developers easier. There are two main considerations for Node.JS use. First, to obtain and install the correct version for a particular need. Second, to then secure the installation in order to keep hackers at bay.
Node.js has a lot to offer in running server-side code. When paired with a package manager, it's an unbeatable combination that makes the work of both administrators and developers easier. There are two main considerations for Node.js use. First, to obtain and install the correct version for a particular need. Second, to then secure the installation in order to keep hackers at bay.
Original file line number Diff line number Diff line change
Expand Up @@ -341,7 +341,7 @@ Celery's ease of use comes from the decorator `@task` that adds Celery methods t

1. [**Webhooks**](https://en.wikipedia.org/wiki/Webhook): Flower provides an API that allow you to interact with Celery by means of REST HTTP queries.

2. [**AMQP**](https://www.amqp.org/): The `@task` decorator sends message to the broker when you call celery methods like `.delay()`. Some languages provide modules that perform this task for you, including [node-celery](https://github.com/mher/node-celery) for NodeJS, or [celery-php](https://github.com/gjedeer/celery-php) for PHP.
2. [**AMQP**](https://www.amqp.org/): The `@task` decorator sends message to the broker when you call celery methods like `.delay()`. Some languages provide modules that perform this task for you, including [node-celery](https://github.com/mher/node-celery) for Node.js, or [celery-php](https://github.com/gjedeer/celery-php) for PHP.

You can use `curl` to practice interacting how to use the Flower API.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ protect=1
curl --silent --location https://rpm.nodesource.com/setup_8.x | bash -
1. Install NodeJS:
1. Install Node.js:
yum install -y nodejs
Expand Down

0 comments on commit fb2ead7

Please sign in to comment.