Node.js and CSS Quiz

Choose a study mode

Play Quiz
Study Flashcards
Spaced Repetition
Chat to Lesson

Podcast

Play an AI-generated podcast conversation about this lesson

Questions and Answers

Which variable represents a normal blue color?

  • $color-blue-normal (correct)
  • $color-blue-ultra-light
  • $color-blue-mid
  • $color-blue-light

Which of the following is defined as the default color?

  • $color-default
  • $color-grey-normal (correct)
  • $color-blue-normal
  • $color-white-normal

Which file contains global CSS styles not bound to a specific module?

  • Person.js
  • Person.module.scss
  • styles.css
  • globals.css (correct)

What is the primary purpose of the Person.js file?

<p>To render a person's resume. (C)</p> Signup and view all the answers

Which file type is less powerful than SCSS files?

<p>CSS files (D)</p> Signup and view all the answers

What is the primary purpose of Node.js?

<p>To enable server-side JavaScript programs. (B)</p> Signup and view all the answers

What is the Node Package Manager (NPM) mainly used for?

<p>Installing software packages to enhance a website. (A)</p> Signup and view all the answers

What is the main benefit of using Node Version Manager (NVM)?

<p>It enables switching between different Node.js versions (A)</p> Signup and view all the answers

Which command is used to install the required Node.js modules?

<p><code>npm install</code> (D)</p> Signup and view all the answers

Which command is used to install Node.js version 18.18.2 using NVM on Windows?

<p>nvm install 18.18.2 (D)</p> Signup and view all the answers

Which file stores environment variables for the application?

<p>.env.local (D)</p> Signup and view all the answers

How do you check which version of Node.js is installed?

<p>node --version (B)</p> Signup and view all the answers

How can you list all installed Node.js versions using NVM on macOS?

<p>nvm ls (C)</p> Signup and view all the answers

What is the purpose of the STORYBLOK_PREVIEW_SECRET variable?

<p>To authorize access for previewing content (D)</p> Signup and view all the answers

What is the function of an HTTPS proxy when developing locally with Storyblok CMS?

<p>To facilitate secure communication between a local PC and Storyblok CMS. (A)</p> Signup and view all the answers

In the Storyblok preview URL, what should YOUR_STORYBLOK_PREVIEW_SECRET_GOES_HERE be replaced with?

<p>The actual secret value (B)</p> Signup and view all the answers

What is the typical protocol and port used for the local development server?

<p><a href="https://localhost:3010">https://localhost:3010</a> (A)</p> Signup and view all the answers

Which of these statements accurately describes Node.js?

<p>It is a framework that allows Javascript to be utilized for server-side programming. (A)</p> Signup and view all the answers

What action is needed to enable the Storyblok visual editor?

<p>Set the default environment location in Storyblok to <code>https://localhost:3010/</code> (A)</p> Signup and view all the answers

After setting up the environment, how do you start the debugging mode in VSCode?

<p>By using the &quot;play&quot; icon in the debug view (D)</p> Signup and view all the answers

What is the final step to test the local development server?

<p>Navigate to <code>https://localhost:3010/people/jan-moons</code> in the browser (C)</p> Signup and view all the answers

What command is used to build the site locally in a way that mirrors Vercel's production build process?

<p><code>npm run build</code> (B)</p> Signup and view all the answers

Where can environment variables be set for a Vercel project after an initial failed build?

<p>Project&gt;Settings&gt;Environment Variables (B)</p> Signup and view all the answers

How can a new build be triggered from the 'Deployments' page in Vercel?

<p>By selecting a build and choosing to redeploy to Production. (B)</p> Signup and view all the answers

What action is required to reflect changes made to the site's content online, when the site is statically generated?

<p>Both code and content changes require a new build. (C)</p> Signup and view all the answers

What is the function of a deploy hook in Vercel?

<p>A unique URL that triggers a new deployment. (C)</p> Signup and view all the answers

What is the role of a webhook in the context of content changes and Vercel?

<p>It's an event that calls a deploy hook when content is saved or published. (C)</p> Signup and view all the answers

After successfully deploying your site to Vercel, what is the key change in the URL that can be noticed?

<p>It is a publicly accessible URL. (C)</p> Signup and view all the answers

If environment variables are forgotten initially, what must be done to ensure that new values are picked up by Vercel?

<p>After setting them, a new build must be triggered. (C)</p> Signup and view all the answers

Which of the following best describes the primary difference between Google Analytics and HotJar?

<p>Google Analytics is a web analytics tool, whereas HotJar is a session analytics tool focused on user interactions. (D)</p> Signup and view all the answers

In the described development process, what is the primary function of Vercel?

<p>Hosting the software and making it accessible to end users. (C)</p> Signup and view all the answers

Which tool is primarily used for local code testing and debugging?

<p>Visual Studio Code/Chrome Developer Tools (C)</p> Signup and view all the answers

What role does GitHub play in the development process described?

<p>It is the platform where code changes are stored and managed online. (A)</p> Signup and view all the answers

What is the purpose of an 'integration' environment in a real-world development setting?

<p>To enable the software to be tested in the context of other software it interacts with. (C)</p> Signup and view all the answers

What does an 'acceptance' environment provide for the software development process?

<p>A space for testers or designated end-users to try out changes before release. (B)</p> Signup and view all the answers

Which of the following tools is explicitly described as an email communication tool?

<p>SendInBlue (D)</p> Signup and view all the answers

According to the passage, what causes the deployment process to happen automatically when using Vercel?

<p>When changes are pushed to the online GitHub repository. (C)</p> Signup and view all the answers

What is the primary purpose of a Vercel Deploy Hook?

<p>To manually trigger a deployment of a specific branch to Vercel by making an API call. (C)</p> Signup and view all the answers

In the context of the described code execution order, what is the role of getStaticPaths?

<p>To retrieve a list of all possible paths the site needs to render on the server. (A)</p> Signup and view all the answers

Which of the following best describes the purpose of getStaticProps?

<p>It fetches and provides the data required for a specific page based on the URL. (B)</p> Signup and view all the answers

What is the correct order of code execution when processing an incoming request, according to the material?

<p><code>[[...slug]].js/getStaticPaths</code>, <code>[[...slug]].js/getStaticProps</code>, <code>_app.js/MyApp</code>, <code>[[...slug]].js/Page</code> (C)</p> Signup and view all the answers

What is the role of the _app.js/MyApp component?

<p>To establish site-wide initializations of your application. (B)</p> Signup and view all the answers

Why would a website be statically generated when deploying to Vercel?

<p>To optimize website performance with pre-built HTML, CSS, and JS files. (A)</p> Signup and view all the answers

Which of these is NOT one of the primary component systems described in this content?

<p>A version control system (D)</p> Signup and view all the answers

What action initiates the fetching of data for a specific URL in this setup?

<p>Requesting a specific path (A)</p> Signup and view all the answers

Flashcards

SCSS Variable

A variable, in SCSS, defined with a dollar sign ($) followed by the name of the variable and a colon (:). The value of the variable is set after the colon.

Global CSS File

A CSS file used to store general, non-module-specific CSS styles, applying globally to the website.

Why SCSS is More Powerful than CSS?

SCSS files are more powerful than CSS files because they offer advanced features like variables, mixins, and nested rules.

Person Component

A component representing a person's profile on a resume-related website, typically holding information about their skills, experience, etc.

Signup and view all the flashcards

Storyblok Component

A Storyblok component, a building block used for managing content within the Storyblok platform. It allows for customization and flexible content structure.

Signup and view all the flashcards

Node.js

A server-side JavaScript framework that allows you to use JavaScript for creating server-side programs like command-line tools and server scripts.

Signup and view all the flashcards

NPM (Node Package Manager)

A package manager that can install, update, and manage software packages on a computer.

Signup and view all the flashcards

NVM (Node Version Manager)

A tool that manages different versions of Node.js and NPM on your computer. It allows you to switch between versions easily.

Signup and view all the flashcards

Installing an HTTPS Proxy

A process of enabling secure communication between your local development computer and the Storyblok Content Management System (CMS).

Signup and view all the flashcards

Command Window (Windows) or Terminal (macOS/Linux)

A program that lets you interact with your computer's operating system using text commands.

Signup and view all the flashcards

node --version

A command used to check the currently installed version of Node.js.

Signup and view all the flashcards

nvm install [version number]

A command used to install a specific version of Node.js using NVM.

Signup and view all the flashcards

nvm list

Command used to list all installed versions of Node.js using NVM.

Signup and view all the flashcards

npm install

A command used to install a package or dependency locally within a project's directory. It will create a 'node_modules' folder and install all necessary dependencies specified in the 'package.json' file.

Signup and view all the flashcards

env.local file

A configuration file used to store environment-specific variables, such as API keys, database credentials, and other sensitive information. It is typically used to separate these variables from the main codebase for security and flexibility.

Signup and view all the flashcards

STORYBLOK_API_KEY

An API key is a unique identifier that gives access to a service or platform. It is used for authentication and authorization to access resources like data or functionality.

Signup and view all the flashcards

STORYBLOK_PREVIEW_SECRET

A secret code used to authenticate a user or a system to access a specific resource or feature, typically used to protect access to sensitive information.

Signup and view all the flashcards

Preview endpoint

A URL endpoint used for entering preview mode in Storyblok. The endpoint usually includes a secret parameter for authentication.

Signup and view all the flashcards

Exit Preview endpoint

A URL endpoint used to exit preview mode and return to the normal view in Storyblok. It usually includes a 'slug' parameter for navigation.

Signup and view all the flashcards

Default environment location

The default location for the project's web server. Storyblok uses this to display content from your local development server within its Real Time visual editor frame.

Signup and view all the flashcards

Debugging mode

The environment used for debugging and development. It allows you to test and alter code without affecting the production environment.

Signup and view all the flashcards

Local Development Environment

A development environment where code is initially developed and tested before being pushed to the production environment.

Signup and view all the flashcards

IDE and Browser Developer Tools

Tools used to test code within the local development environment.

Signup and view all the flashcards

GitHub

An online repository where code is stored and managed, allowing for collaboration and version control.

Signup and view all the flashcards

Production Environment

The stage where the code is deployed and made accessible to users on the web.

Signup and view all the flashcards

Vercel

A service that automatically deploys code to a production environment, triggered by changes in the repository.

Signup and view all the flashcards

Integration Environment

A stage in development where code is tested with other software it needs to function.

Signup and view all the flashcards

Acceptance Environment

A stage where designated testers or end-users evaluate code before the full release.

Signup and view all the flashcards

Simplified Development Process

A simple overview of the development process, consisting of local development, testing, pushing to a repository, deploying to a production environment, and finally users accessing the deployed application.

Signup and view all the flashcards

What does "npm run build" do?

A command used in the terminal to build your website, replicating how Vercel will build it for production deployments.

Signup and view all the flashcards

What are Environment Variables?

Environment variables in your project, set on Vercel, influence how your website behaves. For example, they can store API keys or database credentials. Example variables include your email and Github URLs.

Signup and view all the flashcards

How do code and content changes trigger a build?

Vercel has a unique URL for each project called a "deploy hook". External software can trigger a new deployment by calling this URL. StoryBlok uses webhooks, which are triggered by events like content saving, to call this deploy hook, resulting in a new Vercel deployment.

Signup and view all the flashcards

What happens when you change content on your website?

When changes are made to your website's content, a new deployment is necessary to reflect the changes. This process involves triggering a build using webhooks which then call the unique deploy hook associated with your Vercel project, ultimately resulting in an updated site.

Signup and view all the flashcards

Why does code changing trigger a build?

When you change code in your website (e.g., SCSS styles), Vercel will recognize the change during the deployment process and rebuild the website to incorporate the new code.

Signup and view all the flashcards

What is deploying to Vercel?

This refers to deploying your website to Vercel, which then makes your website accessible to the public through its publicly accessible URL. Deploying includes setting environment variables and allows you to deploy new builds and content changes.

Signup and view all the flashcards

What is the "Deployments" page?

A place where you can see history and information about deployments of your website to Vercel.

Signup and view all the flashcards

How does Vercel handle changes?

The process of rebuilding your site is triggered when either content or code changes are detected, ensuring the latest updates are reflected in your online website.

Signup and view all the flashcards

Deploy Hook

A feature in Vercel that allows you to trigger a deployment automatically when a specific event happens. This event can be a pull request, a new commit, or even a webhook from another service.

Signup and view all the flashcards

Server-Side Rendering (SSR) with getStaticPaths and getStaticProps

A powerful method for generating static pages on the server. It first fetches all possible URL paths and then retrieves data specific to each path.

Signup and view all the flashcards

The _app.js file

A special file in Next.js that defines the layout and structure of the website, including the header, footer, and other global components. It acts as a container for all other pages.

Signup and view all the flashcards

The [[...slug]].js/Page file

This special file in a Next.js project allows you to create pages dynamically by connecting them to Storyblok's visual editor and initializing the pages with data.

Signup and view all the flashcards

Static Site Generation (SSG)

A method of creating Web pages that are completely generated on the server and then served to the user as static files. This results in fast loading times and improved SEO.

Signup and view all the flashcards

The [[...slug]].js/Page component

The core of your application's user interface. It holds all user-facing content and interacts with its underlying data sources. In this case, it's specifically referring to the Storyblok component that displays data and visual elements.

Signup and view all the flashcards

Dynamic Storyblok Component

A type of component in Next.js and Storyblok that focuses on specific types of data, such as information about a person or an experience. It's designed to be reused throughout your website.

Signup and view all the flashcards

StoryBlok

A content management system (CMS) that allows you to edit and manage website content without needing to know code.

Signup and view all the flashcards

Study Notes

Connecting the CMS and the Site

  • Introduction
    • The data model was introduced and implemented in Storyblok
    • The resume website needs to connect to the new data model in the content management system
  • Getting the Code
    • The easiest way to get the code for the Resume project is to fork it.
    • Instructions for forking the repository are available at: https://docs.github.com/en/get-started/quickstart/fork-a-repo
    • Steps to get the code:
      • Log in to your GitHub account
      • Search for JanMoonsUGent/resume
      • Open the repository
      • Fork the repository
      • You will now be in your account/resume
  • Git Clone vs. Fork
    • Developers who work on a common codebase will clone the repository to synchronize changes
    • Forking creates a new codebase. Updates to a fork are not synchronized with the original repo
  • Cloning the Project
    • Use the GitHub CLI to clone the project from your online GitHub account to your local computer. This is described in part 1, starting from step 7

Software Structure

  • After cloning, open the folder in VSCode
  • The file structure is a Next.js project
  • Important folders/files:
    • components: Contains JavaScript files for UI components
    • node_modules: Contains external modules used by the site
    • public: Contains publicly accessible assets (e.g., images)
    • styles: Contains CSS stylesheets (using SCSS)
    • pages: Contains Next.js pages. Includes [[...slug]].js, _app.js, and _document.js which are relevant for StoryBlok
  • Specific files:
    • _app.js: Initializes pages in NextJS
    • [[...slug]].js: Uses dynamic routes based on Storyblok information. The catch-all route handler runs before any page.
    • styles/colors.scss: Contains CSS color variables
  • Code examples:
  • pages/_app.js: maps Storyblok component names to Next.js component names
  • pages/[[...slug]].js: responsible for executing for every URL request to the site and includes three important methods:
  - getStaticPaths: gets all possible paths for the server-side rendering of pages
  - getStaticProps: retrieves data from the CMS needed for the current page
  • components/genericComponents/Person/Person.js: Displays person information, including experience. Uses storyblokEditable to support real-time editing in Storyblok.
  • components/genericComponents/Experience/Experience.js: Displays experience information. Uses RichTextToHTML to handle rich text content from Storyblok, making the code snippet dynamically generate HTML.

Environment Variables

  • .env.local: Contains sensitive information like API keys, preview secret key, and deployment URL
  • STORYBLOK_API_KEY: Allows connection to the Storyblok CMS
  • STORYBLOK_PREVIEW_SECRET: Used for previewing the site within Storyblok
  • NEXT_PUBLIC_DEPLOY_URL: URL to the site after deployment

Deployment to Vercel

  • Deploy the project to Vercel using the deployment button
  • Set the environment variables in Vercel settings before deploying
  • Now the site will be accessible online.

Additional Notes

  • npm run build: Builds the site for production.
  • Deployment hooks and webhooks can be used to automatically rebuild the website when changes are made in Storyblok.
  • If environment variables aren't correctly configured, the site may not function correctly.

Studying That Suits You

Use AI to generate personalized quizzes and flashcards to suit your learning preferences.

Quiz Team

Related Documents

More Like This

Node.js Module System: Common JS
18 questions
Understanding package.json in Node.js
5 questions
Backend Development: NPM and Modules
34 questions
Digital Ocean Tutorial Commands
48 questions

Digital Ocean Tutorial Commands

FlatteringCornflower1855 avatar
FlatteringCornflower1855
Use Quizgecko on...
Browser
Browser