Node Flashcards

1
Q

pwd

A

print the current directory you in

where am I

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

echo

A

print content

console.log

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

touch

A

access time of the last edit time of the file

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

ls ‘xxx’

A

list directory contents
xxx: target directory

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

mkdir

A

create directory

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

mv

A

rename directory or file

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

rm

A

delete file only or use -r

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

cp

A

copy files or directories

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

rmdir

A

delete directory

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

What is a CLI?

A

command line interface

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

What is a GUI?

A

graphacial user interface

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

man

A

an interface to the system reference manuals

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

cat

A

concatenate files and print on the standard output

print the content of files

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

ls

A

list directory contents

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

What is Node.js?

A

Node.js 是能够在服务器端运行JavaScript 的开放源代码、跨平台执行环境。

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

What can Node.js be used for?

A

It is used for server-side programming, and primarily deployed for non-blocking, event-driven servers, such as traditional web sites and back-end API services, but was originally designed with real-time, push-based architectures in mind.

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

What is a REPL?

A

Read–eval–print loop)
“读取-求值-输出”循环,也被称做交互式顶层构件,是一个简单的,交互式的编程环境。这个词常常用于指代一个Lisp的交互式开发环境,也能指代命令行的模式。

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

What is the process object in a Node.js program?

A

data model of

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

How do you access the process object in a Node.js program?

A

just reference it

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

What is the data type of process.argv in Node.js?

A

array of strings

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

What is a JavaScript module?

A

module is the file with code

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

What values are passed into a Node.js module’s local scope

A

exports, require, module, __filename, __dirname

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

Give two examples of truly global variables in a Node.js program.

A

process, global

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

What is the purpose of module.exports in a Node.js module?

A

make it available to other modual

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
25
How do you import functionality into a Node.js module from another Node.js module?
call require with () require here is a reference (or a copy) of module.export.
26
What is the JavaScript Event Loop?
the event loop is the part of a JS runtime environment, that pushes asynchronous callback onto the callstack when callstack is clear
27
What is different between "blocking" and "non-blocking" with respect to how code is executed?
Blocking refers to operations that block further execution until that operation finishes while non-blocking refers to code that doesn't block execution. block (synchronous): this code will processed first , after it processed , rest code can be executed (ex: loop) non-block (asynchronous): this code will processed, while it is processing , rest code can be executed too. (ex: HTTP request AJAX)
28
What is a directory?
list of files
29
What is a relative file path?
get from where you are to where you want to go
30
What is an absolute file path?
location of file from root directory
31
What module does Node.js include for manipulating the file system?
fs module
32
What method is available in the Node.js fs module for writing data to a file?
fs.writeFile
33
Are file operations using the fs module synchronous or asynchronous?
34
What is a client?
a program send request to server
35
What is a server?
a server send request back to user
36
Which HTTP method does a browser issue to a web server when you visit a URL?
GET
37
What is on the first line of an HTTP request message?
GET request-target(the thing you ask server for, if it's / means give me whatever you have) HTTP/1.1 (format)
38
curl
just like httpie bur less functional , build in every computer. curl=see url
39
What is on the first line of an HTTP response message?
protocol message , code, status
40
What are HTTP headers?
extra info, just like head of html elements
41
Is a body required for a valid HTTP message?
no
42
domain name system
a bunch of servers that loop up IP address for domains, they also remember them for a while (like a phone book, when you got the URL ex.amazon.com, it will look for the IP of this website)
43
nc
make internet connect and catch all the stuff
44
what is behind the webpage url(domain name)
ip address. each website have different ip addresses
45
http port?
Default in http is 80 in https is 443 (drive to a restaurant , window you can order and perform actions)
46
What is NPM
website, registration list, cml Registration have pacgages you can download by using cml
47
How can you create a package.json with npm?
npm init --yes
48
What is a dependency and how to you add one to a package?
dependency: modules from npm how to add: npm install xxx
49
What happens when you add a dependency to a package with npm?
the package.json is updated with the new dependency and the package is downloaded from the npm registry to node_modules
50
What is a package?
modules create by others and published on npm
51
Which objects does an Express application pass to your middleware to manage the request/response lifecycle of the server?
req, res
52
How do you mount a middleware with an Express application?
use()
53
address().port
shows the port number
54
What is the appropriate Content-Type header for HTTP messages that contain JSON in their bodies?
application/json
55
What does the express.json() middleware do and when would you need it?
56
app.delete('/api/grades/:id', (req, res) =>{}
:id is a placeholder
57
What are some advantages of learning a relational database?
58
What is PostgreSQL and what are some alternative relational databases?
widely use
59
What is one way to see if PostgreSQL is running?
sudo service postgresql status
60
What is a database schema?
schema define structure
60
What is a database schema?
schema define structure of datas
61
What is a table?
list of rows have same attribute
62
What is a row?
the data