NPM/Express/PostGres Flashcards

1
Q

What is NPM?

A

Its a package manager that allows us to install dependencies into our project, essentially modules.

A giant website/massive collection of modules where user can upload solution to the problem they solved so other people can use it also. is the world’s largest software registry, where user can share and borrow packages

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

What is a package?

A

Essentially, its a module that we can get access to.
A package is:
a) a folder containing a program described by a package.json file
b) a gzipped tarball containing (a)
c) a url that resolves to (b)
d) a <name>@<version> that is published on the registry (see registry) with (c)
e) a <name>@<tag> (see npm dist-tag) that points to (d)
f) a <name> that has a "latest" tag satisfying (e)
g) a <git> that resolves to (a)</git></name></tag></name></version></name>

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

with the command npm init –yes/npm init

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

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

A

Its what required for your application to work
npm install <package-name> [--save-prod]/npm i <package></package></package-name>

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 Dependencies will get stored in the package. json file. and we get node module folder. (all the info needed for your application to run)

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

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

app.listen()

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 use method

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

respond(res) and req(request) object

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

What is middleware?

A

Its just a function that get called, it does something to the request, and then the request continues. Its a function that add some functionality somewhere in the process. A common thing middleware might do is run some authentication software, print something to the console…software that acts as a bridge between an operating system or database and applications, especially on a network.

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

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

A

app/json

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

HTTP defines a set of request methods to indicate an action to be performed for a given resource. It also, allows us to set up individual routes depending on what method was used.

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

What is params?

A

Params is always going to contain whatever data is in the url of the request. app.delete(‘/api/grades/:id’)
const id = Number(req.params.id)

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

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

A

When we call the middleware, it returns to us a body parser and if we use that with the use method on the express server that we created, then it would take any json that is sent in the body of the request and convert it so then we can use inside of our end point. We need anytime that we are sending json on the body of request. It allows us to parse the body of json so then we can use it inside of our code.

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

What is PostgreSQL and what are some alternative relational databases?

A

Its a free way to store your data for server
MySQL, SQL Server by Microsoft, and Oracle by Oracle Corporation.

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

What are some advantages of learning a relational database?

A

Relational database is very good for storing information related to collection of data. Its a way of taking a whole bunch of data and then having relationships between them to make it easy to access. Ex: students table -> what information you will have to store about students?

17
Q

What is one way to see if PostgreSQL is running?

A

sudo service postgresql status/ execute the top command

18
Q

What is a database schema?

A

Design/structure of the data base. Its usually composed of one or more tables and it is the structure for the data. It is the collection of all of the tables, their categories, their columns, and the way that all the data is designed to be split up.

19
Q

What is a table?

A

A table is a collection of columns and rows that have the different type of data we’re storing.

20
Q

What is a row?

A

row is a collection of data for an individual item.