Express Flashcards
NODEJS What is it and what is its function?
Node.js is a runtime environment (a program that runs other programs), a platform used to execute JavaScript applications outside the browser.
What does JSON mean?
JSON is (JavaScript Object Notation) this helps the web-server communicate with clients
What are some of the advantages of using NODE.js server-side code?
1) ..JavaScript on the server: use the same programming language and paradigm for both client and server. This minimizes context switching and makes it easy to share code between the client and the server.
2) ..Single-threaded: removes the complexity involved in handling multiple threads.
3) ..Asynchronous: can take full advantage of the processor it’s running on. This matters because the node process will be running on a single CPU.
4) ..Npm repository: access the largest ecosystem of useful libraries (most of them free to use) in the form of npm modules.
What are some of the Disadvantages of using NODE.js server-side code?
1) ..JavaScript on the server: we lose the ability to use the right tool (language) for the job.
2) ..single-threaded: can’t take advantage of servers with multiple cores/processors.
3) ..asynchronous: it is harder to learn for developers that have only worked with languages that default to synchronous operations that block the execution thread.
4) ..npm repository: too many packages that do the same thing makes it harder to choose one and, in some cases, may introduce vulnerabilities into our code.
How would you write a simple web server with Node.js?
1) .. Use Node’s HTTP module to abstract away complex network-related operations.
2) .. Write the single request handler function that will handle all requests to the server.
The request handler is a function that takes the request coming from the client and produces the response. The function takes two arguments: 1) an object representing the request and 2) an object representing the response.
This process works, but the resulting code is verbose even for the simplest of servers. Also, note that when using only Node.js to build a server, we use a single request handler function for all requests.
What is
User Interface?
Is the combination of HTML(“Hypertext Markup Language”) & CSS(“Styles the HTML”)
What is GIT and how do you use it?
Git is a distributed version control system
Git monitors and controls code changes made during development across several people and teams.
What is HTML?
HTML is one of the languages we use for web development.
HTML is what we call a “markup language” (as opposed to a “programming” language like JavaScript or Python).
A markup language means that it is specifically designed to display data in a graphical form (rather than execute tasks).
What are some HTML Elements?
HTML elements are like boxes of content on our web page. Different types of content can be in these boxes for example <h1></h1>
h1 = header for titles or most important content
can only be used once in a coding program.
<h1> Lambda School is Awesome </h1>
What are tags?
If we wanted to tag the sentence above as an essential header (the biggest text by default), we’d use the <h1> and </h1> beginning and end tags, as shown below.
Tags identify elements in your code each element has text
So What are Divs, Headers, Paragraphs, and Spans?
These are display elements
How would you display a Paragraph in HTML?
<p> The p ("paragraph") element. This element is meant for holding text. By default, it will render text to the screen on a new line.
</p><p>Here is a paragraph!</p>
What is a div?
<div>
The div element is a generic container. It is used primarily for grouping other HTML elements together. It is invisible by default but can be used to position or style a group of elements. Div isn't super helpful in plain HTML but will become powerful when we "stack" HTML with JavaScript and CSS.
<div> is a block-level element, meaning it will take up a full line.
<div>
<p>This paragraph is about grapefruits.</p>
<p>This paragraph is also about grapefruits! I guess it's related to the paragraph above.</p></div></div></div>
What is a span element?
<p>This paragraph contains a <span>very important phrase</span> that should be styled in some way.</p>
<span>
The span element is a generic text container. It does not create a new line as the p element does. This element is invisible by default but can style words or phrases within a larger body of text.
Unlike <div>, <span> operates inline and therefore doesn’t take up its own line.
</span></div></span>
What are h tags?
<h1>-</h1>
<h6>
These are heading tags. They are intended to be used as a way to present the subject matter of the page. 1 is the most important, and 6 is the least important. By default, 1 will be the largest, 2 will be the next largest, etc.
Avoid using heading tags to resize text. Headings use size to indicate their relative importance, but CSS is preferred for general-purpose resizing.
You should only use one </h6>
<h1> per page. Using more than one will not result in an error, but using only one is seen as a best practice. It makes logical sense — </h1>
<h1> is the most important heading and tells you the purpose of the overall page. You wouldn't have a book with more than one title or a movie with more than one name! Having a single top-level title is also arguably better for screen reader users and SEO.
</h1>