Node Flashcards

1
Q

In Node, what is the package.json file?

A

It shows the project name, version, author, dependencies, a list of scripts, and more about the project

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

What is the “scripts” object in package.json?

A

A list of scripts that can be run with the syntax:

npm run script-name

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

What does the “proxy” property refer to in package.json?

A

It proxies api requests to start with a base URL

i.e. “proxy”: “http://localhost:5000”

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

What is the “concurrently” Node package used for in full stack development?

A

Running the client and server side code simultaneously

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

In Node, what does the –prefix flag do?

npm start –prefix name

A

Enables you to run a npm command against a different directory
(i.e. npm start –prefix client)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

What is the syntax for the “concurrently” package to run both the client and the server commands from “scripts”?

A

“dev”: “concurrently "npm run client" "npm run server"”

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

In the scripts section of package.json, why would you add “client-install” script that uses npm install on the client directory?

A

To help install the client-side dependencies for when the project is cloned (i.e. from Git)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

In a MERN application, where should bootstrap and reactstrap be installed?

A

In the client directory (all front-end code is in here)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

How would you import ‘uuid’ into a MERN module?

A

import {v4 as uuid} from ‘uuid’;

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

What is does “process” (i.e. process.env) represent in Node?

A

The current process. One process is run per Node script. Therefore, this is a global object.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

What is the syntax for printing the code that’s currently running in Node.js?

A

var fs = require(‘fs’);

fs.createReadStream(__filename).pipe(process.stdout)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly