Express Flashcards

1
Q

How do you refer to an Express router?

A

Call the express object’s Router() method to create a new router object:

const router = express.Router();

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

In Express, how do you start the server on a specific port?

A

app.listen(port_number, () => doSomething());

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

In Express, what does “app.use” do?

A

It adds a layer to the Express “middleware stack”

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

In Express, what does the following line do?

app.use(./local/path, pathVariable);

A

Whenever a request is made to /local/path, the pathVariable is the endpoint that is actually hit

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

When writing a Mongoose schema file, what should the export statement look like (pre-ES6)?

A

module.exports = Item = mongoose.model(‘item’, ItemSchema)

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

What is Express(.js)?

A

A backend framework for creating APIs

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