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
Q

How do you import functionality into a Node.js module from another Node.js module?

A

call require with ()
require here is a reference (or a copy) of module.export.

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

What is the JavaScript Event Loop?

A

the event loop is the part of a JS runtime environment, that pushes asynchronous callback onto the callstack when callstack is clear

27
Q

What is different between “blocking” and “non-blocking” with respect to how code is executed?

A

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
Q

What is a directory?

A

list of files

29
Q

What is a relative file path?

A

get from where you are to where you want to go

30
Q

What is an absolute file path?

A

location of file from root directory

31
Q

What module does Node.js include for manipulating the file system?

A

fs module

32
Q

What method is available in the Node.js fs module for writing data to a file?

A

fs.writeFile

33
Q

Are file operations using the fs module synchronous or asynchronous?

A
34
Q

What is a client?

A

a program send request to server

35
Q

What is a server?

A

a server send request back to user

36
Q

Which HTTP method does a browser issue to a web server when you visit a URL?

A

GET

37
Q

What is on the first line of an HTTP request message?

A

GET request-target(the thing you ask server for, if it’s / means give me whatever you have) HTTP/1.1 (format)

38
Q

curl

A

just like httpie bur less functional , build in every computer. curl=see url

39
Q

What is on the first line of an HTTP response message?

A

protocol message , code, status

40
Q

What are HTTP headers?

A

extra info, just like head of html elements

41
Q

Is a body required for a valid HTTP message?

A

no

42
Q

domain name system

A

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
Q

nc

A

make internet connect and catch all the stuff

44
Q

what is behind the webpage url(domain name)

A

ip address. each website have different ip addresses

45
Q

http port?

A

Default in http is 80
in https is 443

(drive to a restaurant , window you can order and perform actions)

46
Q

What is NPM

A

website, registration list, cml

Registration have pacgages you can download by using cml

47
Q

How can you create a package.json with npm?

A

npm init –yes

48
Q

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

A

dependency: modules from npm
how to add: npm install xxx

49
Q

What happens when you add a dependency to a package with npm?

A

the package.json is updated with the new dependency

and the package is downloaded from the npm registry to node_modules

50
Q

What is a package?

A

modules create by others and published on npm

51
Q

Which objects does an Express application pass to your middleware to manage the request/response lifecycle of the server?

A

req, res

52
Q

How do you mount a middleware with an Express application?

A

use()

53
Q

address().port

A

shows the port number

54
Q

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

A

application/json

55
Q

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

A
56
Q

app.delete(‘/api/grades/:id’, (req, res) =>{}

A

:id is a placeholder

57
Q

What are some advantages of learning a relational database?

A
58
Q

What is PostgreSQL and what are some alternative relational databases?

A

widely use

59
Q

What is one way to see if PostgreSQL is running?

A

sudo service postgresql status

60
Q

What is a database schema?

A

schema define structure

60
Q

What is a database schema?

A

schema define structure of datas

61
Q

What is a table?

A

list of rows have same attribute

62
Q

What is a row?

A

the data