Back End Development and APIs Flashcards
What is a .env file for?
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 do you access environment variables?
process.env.VAR_NAME
What is process.env?
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.
What is middleware?
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.
What does the next function do?
It calls the next middleware function in line.
What are route parameters?
What is the POST method used for?
In REST convention, POST is used to send data to create new items in the database (a new user, or a new blog post).
What is a payload?
In the context of backend, payload is the body of the HTTP request.
What is the difference between Mongoose & MongoDB?
Mongoose is the npm package that allows you to interact with the MongoDB. It allows you to use JS and create schemas.
What is the difference between a Mongoose Schema vs. Model?
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.