Back End Development and APIs Flashcards

1
Q

What is a .env file for?

A

It’s a private file used to pass environment variables in your application. It can be used to store data that you want to keep private or hidden such as API keys.

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

How do you access environment variables?

A

process.env.VAR_NAME

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

What is process.env?

A

It’s a global Node object that is injected by Node at runtime for your application to use and it represents the state of the system environment your application is in when it starts.

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

What is middleware?

A

Middleware is essentially a block of code that’s executed before the controller sends the response and after the server gets the request from the client.

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

What does the next function do?

A

It calls the next middleware function in line.

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

What are route parameters?

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

What is the POST method used for?

A

In REST convention, POST is used to send data to create new items in the database (a new user, or a new blog post).

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

What is a payload?

A

In the context of backend, payload is the body of the HTTP request.

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

What is the difference between Mongoose & MongoDB?

A

Mongoose is the npm package that allows you to interact with the MongoDB. It allows you to use JS and create schemas.

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

What is the difference between a Mongoose Schema vs. Model?

A

A Mongoose model is a wrapper on the Mongoose schema. A Mongoose schema defines the structure of the document, default values, validators, etc., whereas a Mongoose model provides an interface to the database for creating, querying, updating, deleting records, etc.

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