NPM - Express Flashcards

1
Q

What is NPM?

A

a website,
CLI,
a registry,

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

What is a package?

A

reusable code
a directory with files in it
contains package.json

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

How can you create a package.json with npm?

A

npm init –yes

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

What is a dependency and how do you add one to a package?

A

It’s a package that your app/website needs in order to run. You add one with the install command

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

What happens when you add a dependency to a package with npm?

A

The dependency property in package.json is updated and it allows you to use the dependency by downloading it from the npm resgistry and puts it into node modules

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

How do you add express to your package dependencies?

A

you use the npm install command

npm install express

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

What Express application method starts the server and binds it to a network PORT?

A

the listen method()

it takes the optional parameters ([port[, host[, backlog,]]] and [callback]

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

How do you mount a middleware with an Express application?

A

with the use() method

it will be mounted at the path specified

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

Which objects does an Express application pass to your middleware to manage the request/response lifecycle of the server?

A

it passes the req (request) object and the res (response) object to the middleware

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

What is the appropriate Content-Type header for HTTP messages that contain JSON in their bodies?

A

application/json

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

What does the express.json() middleware do and when would you need it?

A

parses incoming JSON request bodies

and you will need it when you are requesting incoming JSON request bodies

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

What is the significance of an HTTP request’s method?

A

it’s semantic

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

What is Webpack?

A

it allows you to bundle all the modules of your dev environment in one place
no bottlenecking with script tags

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

How do you add devDependency to a package?

A

npm install –save-dev webpack

npm install –save-dev webpack-cli

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

How do you execute Webpack with npm run?

A

npm run build

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

What is an NPM script?

A

it allows you to run terminal commands

17
Q

How are ES Modules different from CommonJS modules?

A

the syntax is much more compact that Common… we don’t need to declare variables to import. ES Modules are officially a part of ECMASCRIPT

18
Q

What kind of modules can Webpack support?

A

ALL OF EM