week 7 databases and web programming theory

0.0(0)
Studied by 0 people
call kaiCall Kai
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
GameKnowt Play
Card Sorting

1/103

encourage image

There's no tags or description

Looks like no tags are added yet.

104 Terms

1
New cards

what is TCP?

transmission control protocol, used for reliable packet sending, point 2 point

2
New cards

what is IP?

internet protocol, used for addressing computers and routing packets to them

3
New cards

what is an IP address?

a 32 bit number that addresses a device

4
New cards

how is an IP address organised?

divided into octets, IPv4 has 4 octets, IPv6 has 8 octets of hexadecimal digits

5
New cards

what is a local IP address?

an IP address assigned to a computer for use within a local network

6
New cards

what is a public IP address?

an IP address that people outside an internal network can use to send packets (data) to a computer

7
New cards

what is a socket address?

an IP address with a port number added to the end, to create an endpoint for network communication

8
New cards

what is a port?

a 16 bit number, (65k) services can run on a single IP address

9
New cards

what is DNS?

domain name system, acts as a contact book for IP addresses

10
New cards

what does the DNS do?

converts human-readable domain names (from URL) into an IP address

11
New cards

who can change the IP of a domain?

only the domain owner

12
New cards

who sells and assigns the domain to the domain owner?

registrar

13
New cards

what is HTTP?

hypertext transfer protocol (the main protocol of the web)

14
New cards

what are the main qualities of HTTP?

  • client-server

  • stateless

  • request-respond


15
New cards

what does it mean for HTTP to be stateless?

each request is independent, the server forgets old requests

16
New cards

what does the command “curl http://knowt.com” do?

shows the html content of the page

17
New cards

what are the main methods that can be used on HTTP?

  • GET

  • POST

  • PUT

  • DELETE


18
New cards

what is a header for HTTP?

conveys metadata about the request or response

19
New cards

what is a status code?

tells you what happened to the request

20
New cards

why is HTTPS generally used by default?

HTTP is insecure

21
New cards

what is HTTP also used for?

to implement REST APIs

22
New cards
GET /doc/text.html HTTP/1.1
HOST: www.example.com
User-Agent: Mozilla/4.0
Content-Length: 28 

userid=shahs&search=Anh+Dinh

what would a response look like to this request?

HTTP/1.1 200 OK
Date: Sun, 08 Feb 2022 01:11:12 GMT
Server: Apache/1.3.29
Content-Length: 21 
Content-Type: text/html

<h1> My HomePgae </h1> 


23
New cards

what is HTTPS?

hypertext transfer protocol secure

24
New cards

how is HTTPS different from HTTP?

relies on public key cryptography to encrypt all data between the web browser and web server

25
New cards

what is a web server certificate?

certificate issued and assigned by an authority, only provided to domain owners, so that web clients can check the certificate provided is issues by a trusted authority and check against a standardised list of trusted authorities

26
New cards

what is HTML?

hyptertext markup language, allows you to write structure of a web page and link to other pages

27
New cards

what is CSS?

cascading style sheets, allows you to add style, markup, and design to webpages

28
New cards

what does JavaScript allow for?

allows actions to be completed on a page

29
New cards

what does FTP stand for?

file transfer protocol

30
New cards

what does SSH stand for?

secure shell

31
New cards

what does IMAP stand for?

internet message access protocol

32
New cards

what does SMTP stand for?

simple mail transfer protocol

33
New cards

what is ifconfig?

network interface (if) configuration (config), a legacy protocol that allows you to search the network interface configurations to manage IP addresses and route of current device

34
New cards

what is nslookup used for?

to query DNS server to get domain names and IP addresses, answers why you cannot reach a website by checking if the domain name resolves to the correct IP address

35
New cards

what is ping used for?

check if website, server, or device is online and reachable

36
New cards

what is an issue with using ping?

not fully reliable

37
New cards

what does traceroute do?

shows the route (sequence of routers) of packets from the machine to a target web server, to reveal network bottlenecks/failures and visualise the network hops across the internet

38
New cards

what does curl do?

transfer data to and from a server, for testing HTTP(S), FTP, REST APIs

39
New cards

what is telenet?

an insecure protocol for remote login, tests TCP connections to any service & port by sending raw commands

40
New cards

what is ssh?

a secure remote terminal, running on port 22, to a control a server

41
New cards

what are SSH key pairs for?

access server without manual password entry

42
New cards

what is the main requirement for using ssh key pairs?

keep private key secure

43
New cards

what is a web client?

things that will allow you to go to a webserver and download information, such as curl, firefox, safari, chrome

44
New cards

what is a web server?

any computer that has a public IP address and an open port

45
New cards

what do web servers allow you to do?

run web application server and respond to requests (essentially runs websites)

46
New cards

what was the process for the early dynamic web?

  1. client web browsers display HTML <form>, <input> for search boxes, login fields, feedback forms

  2. user clicks [Submit]

  3. web server runs a script using CGI

  4. CGI executes an external program to get back with dynamic HTML content


47
New cards

what is the issue with the early dynamic web?

it is rarely used now because of its lack of scalability, only one process per request

48
New cards

how does the dynamic web work via MVC?

use of model view control

  • model is data/business logic

  • view is the HTML template with dynamic placeholders

  • controller links the model and view by calling code executed on server

  • hardcoded dependency frontend to backend


49
New cards

what is the issue with MVC frameworks?

it is difficult to add or change front ends

50
New cards

how does the dynamic web work via REST frameworks?

REST is used to send JSON data, implement entire application as one REST API and use it for multiple types of clients

51
New cards

what are the benefits of using REST frameworks for the dynamic web?

  • strongly separates data and presentation (backend is used for data and logic only)

  • allows you to use CRUD applications using HTTP methods

  • allows for microservices, as each entity or resource can have a separate server


52
New cards

why are REST frameworks standard practice for the dynamic web?

scalable architecture, easier for teamwork as responsibilities and code can be shared

53
New cards

what is a tech stack?

a combination of technologies that are used to implement web application

54
New cards

what are the three main parts of a tech stack?

  • front end

  • back end

  • database


55
New cards

what is an API?

application programming interface, a standard library of classes, interfaces, methods, and fields

56
New cards

what is REST?

representational state transfer, an architectural style for web applications and creating APIs

57
New cards

what does a REST API entail?

an API with

  • a base URI

  • standard HTTP methods

  • a media type that defines data elements

  • REST API and documentations


58
New cards

what are the 6 constraints for REST API?

  • uniform interface

  • stateless

  • cacheable

  • client-server

  • layered system

  • (optional) code on demand


59
New cards

what are the CRUD equivalences for HTTP methods?

  • Create → POST

  • Read → GET

  • Update (replace) → PUT

  • Delete → DELETE

  • Update (modify) → PATCH


60
New cards

what are the main design conventions for REST APIs?

  • be as minimal as possible

  • for endpoints, use nouns (entities)

  • do not include verbs (actions)

  • use plural

  • GET is stateless

  • specify the format

  • object relations

    • use sub-resources to get related resources

  • make API version mandatory and use whole numbers

  • allow clients to flexibly deal with large results sets by parsing

  • move useful/commonly used tasks into more accessed paths

  • use status codes in HTTP method to inform clients of request’s execution


61
New cards

what does the 1xx status code mean?

informational, protocol-level info

62
New cards

what does the 2xx status code mean?

success, request was adapted successfully

63
New cards

what does the 3xx status code mean?

redirection, some additional action specified in the code for the client to complete the request

64
New cards

what does the 4xx status code mean?

client error, these error status cods point to a client issue

65
New cards

what does the 5xx status code mean?

server error, the server takes responsibility for the error status

66
New cards

what does the 200 status code mean?

OK

67
New cards

what does the 201 status code mean?

created

68
New cards

what does the 204 status code mean?

no content

69
New cards

what does the 304 status code mean?

not modified

70
New cards

what does the 400 status code mean?

bad request

71
New cards

what does the 403 status code mean?

forbidden

72
New cards

what does the 409 status code mean?

conflict

73
New cards

what does the 401 status code mean?

unauthorised

74
New cards

what does the 404 status code mean?

not found

75
New cards

what does the 500 status code mean?

internal server error

76
New cards

what is JHipster?

a text-stack generator

77
New cards

what is token forgery?

impersonating users

78
New cards

why must the jwtSecretKey be kept private and unique?

to avoid token forgery, elevation of privileges, session hijacking

79
New cards

what are the 4 layers of Springboot?

  • presentation

  • business

  • persistence

  • database


80
New cards

what function does the presentation layer serve in Springboot?

authentication and JSON translation

81
New cards

what function does the business layer serve in Springboot?

business logic, validation, and authorisation checks

  • usually optional

  • deals with sending a request to a different API


82
New cards

what function does the persistence layer serve?

connects to database and gets data out of it, usually a JPA repo, converts Java objects into things that a database can understand

83
New cards

what function does the database layer serve in Springboot?

the actual database, runs on the machine

84
New cards

what is the backend tech for JHipster?

  • Java/Springboot

  • Hibernate/JPA

  • liquibase

  • fakerJS

  • Swagger

  • CI/CD

  • Docker


85
New cards

what is Java/Springboot for?

has classes, program logic, responds to requests via REST

86
New cards

what is Hibernate/JPA for?

object relational mapping to create/evolve the database schema

87
New cards

what is FakerJS for?

database changesets to create/evolve the databse schema

88
New cards

what is Swagger for?

interface and documenting the REST API

89
New cards

what is CI/CD used for?

for continued integration and deployment to a cloud/VM

90
New cards

what is Docker used for?

to package the app to easily run anywhere and deploy

91
New cards

what is JDL?

JHipster Domain Language

92
New cards

what does JDL do?

creates human-readable, visuals, separate from code for entities, field+ types, and relationships between entities, to generate skeleton app template

93
New cards
94
New cards
95
New cards
96
New cards
97
New cards
98
New cards
99
New cards
100
New cards