apps Flashcards
what is the internet?
a network of smaller networks which allows data to be transferred between computers around the world
what is the web?
the web, built on top of the internet, is a system of interlinked documents and other resources with rules and tools to govern how those resources are shared
what are the two parts of a web app?
clients and servers
what do clients do?
make requests to servers
what do servers do?
send back responses to a client
what is AJAX
is a technology that allows apps to retrieve and display data through an API and through another server without having to reload the page
what is an example of AJAX in use?
the unlimited scroll function on twitter or facebook or instagram.
What are HTTP messages?
They are the requests and responses made by the client and the server
Do both response and request HTTP messages follow the same structure?
Yes they both follow the same 4 part structure
What are the 4 parts of an HTTP message?
Startline, headers, an empty line for spacing, and the body
which part of the HTTP message describes the message?
the startline and the header
which part of the http message contains the message data?
the body
what is postman?
it is a tool that allows you to view the requests and responses as raw data
what are 4 of the most popular HTTP request formats youll see?
GET, POST, PUT, DELETE
What does GET do?
READ: requests a visual representation of the document to read of the specified source
(getting search results)
What does POST do?
CREATE: submits an addition to the source
submit a tweet/comment
what does PUT do?
UPDATE: replaces all current representations of source
edit account info
what does DELETE do?
DELETE: deletes source
delete a photo, item
What are “CRUD” operations/apps?
they mean ones that can create, read, update and delete resources
what two parts does the start line consist of?
the version type
and the HTTP status code
Which are the 5 most common HTTP status codes?
200 - Ok 201 - created 401 - unauthorized 404 - Not Found 500 - Internal Server Error
can servers respond with data in JSON format?
yes they can
What is JSON
Javascript object notation. Its the same thing as regular objects expect that the keys must be strings - thats the main difference
what is a fetch API used for?
to make requests to various web API’s
what type of requests does a fetch api make?
requests using any of the HTTP methods –
GET POST PUT DELETE etc
What two parameters does FETCH take?
a required one, which is a URL
and the method type,
GET POST DELETE etc
what is the default method to a fetch?
a GET
What type of response does a fetch return?
A promise
what is a promise?
they are values that are promised to be returned. This allows the app to do other things under the assumption that when the value is found it will be retrieved.
what three types of blocks do we need to use to handle a promise?
a .then( response = response.json()) block
a .then ( responseJson => do whatever you want) block
.catch ( do this if something goes wrong block)
what type of data is a returned promise?
a returned object that can be used in the future
catch blocks on fetch only work under what circumstance?
that an uncaught error happens in one of the previous promise statements
how can we turn a multiline string into an array?
use the .trim( ).split(“ “ ) a variable name containing the string.
let sentence = “ this is a sentence”
newArray = sentence.trim().string(“ “)
return array [“this”, “is”, “a”, “sentence”}
make sure you put a qoutes and a space between qoutes inside of the parens otherwise it will break the string by letter and not by the word
What is an anchor point in react?
It is the empty element in which the react application gets rendered into.
what does the two library files do for us in React?
it creates tow global variables fo rus to use in our script.
React
React DOM
Do we need both parts of React (react and reactDOM) in order for the library to be available for use in a webpage?
yes we do
the react.development.js file does what exactly?
it creates the global variable ‘react’.
it is the “non specific” part.
what does reat-dom.development. js do?
This part contains methods that live on the global variable
‘reactDOM’ which is sued to connect our react code to the DOM
What is the difference between using the
‘development version’ of react as opposed to another version?
The development version gives us more detailed error messages which are helpful when developing
what is ‘document’ in javascript?
it is the object that represent your webpage. All other objects on your page are owned by document.
Document Object =>
Document Object Model => DOM
what does querySelector() do?
it finds the first element that matches a specified CSS selector in the document.
document.querySelector(“.apples”)
this would select the first element with apples as a class
what if you want to use querySelector for all elements that have a particular class/id and not just the first one?
use
querySelectorAll()
The ‘render()’ method accepts two arguments - what are they?
element and container
.render(‘element’, ‘container’)
what is ‘element’ represent in the ‘render( )’ method?
the contents of the container
what is the ‘container’ argument in the ‘render( )’ method?
the place that we want to insert the
‘element’ (contents) into
can we use render( ) to add HTML elements to a container ?
No you cannot, it will add the characters as you put them, not the element it represent.
adding H1 tags and a string will not make a headline – it will literally just show the element tags and string. thats it
How do you add HTML using ‘react’?
React.createElement( )