<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: checode</title>
    <description>The latest articles on DEV Community by checode (@checode).</description>
    <link>https://dev.to/checode</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F2080209%2Fe7d639f0-8afb-47f7-8360-abbd883a8874.png</url>
      <title>DEV Community: checode</title>
      <link>https://dev.to/checode</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/checode"/>
    <language>en</language>
    <item>
      <title>How to Integrate 3D Models into Your Website Using Only HTML and CSS</title>
      <dc:creator>checode</dc:creator>
      <pubDate>Thu, 12 Jun 2025 08:41:29 +0000</pubDate>
      <link>https://dev.to/checode/how-to-integrate-3d-models-into-your-website-using-only-html-and-css-lok</link>
      <guid>https://dev.to/checode/how-to-integrate-3d-models-into-your-website-using-only-html-and-css-lok</guid>
      <description>&lt;p&gt;In this article, I want to show you how to display 3D elements on your website in a very simple way.&lt;/p&gt;

&lt;p&gt;I also made a video about it, so if you're interested, feel free to check it out — but if not, all good! I’ll walk you through everything step by step right here.&lt;/p&gt;

&lt;p&gt;The video is originally in Spanish. AI-generated English voice. Yeah, I know, not ideal. But hey, one day I hope to upload the full thing in English (with a lot of accent 😅).&lt;/p&gt;

&lt;p&gt;  &lt;iframe src="https://www.youtube.com/embed/mSB2scT6fTY?start=156"&gt;
  &lt;/iframe&gt;
&lt;/p&gt;

&lt;p&gt;Anyway, let’s get started with the article step by step.&lt;/p&gt;

&lt;h2&gt;
  
  
  1. How to get a 3D model for your website
&lt;/h2&gt;

&lt;p&gt;The internet is full of 3D models you can download. Either for free or paid.&lt;br&gt;
A well-known place is &lt;a href="https://sketchfab.com/feed" rel="noopener noreferrer"&gt;sketchfab&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;I recommend downloading the model in .gltf or .glb format — these are the ones that work best on the web.&lt;/p&gt;

&lt;p&gt;If you download a .glb file, it’ll come as a single file with the .glb extension.&lt;br&gt;
But if you go with .gltf, you’ll get a folder with multiple files inside you’ll need to unzip it.&lt;/p&gt;

&lt;p&gt;Even though the main file is scene.gltf, don’t delete anything all the files depend on each other, so it’s totally fine to keep them all together in the same folder.&lt;/p&gt;

&lt;p&gt;I found a really cool 3D dragon model that I was able to download for free (shoutout to the creator of the model in the video).&lt;/p&gt;

&lt;p&gt;Once you’ve got your 3D model, let’s move on to step two:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fg7gkoemcdsv9bxkg15rj.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fg7gkoemcdsv9bxkg15rj.png" alt="sketchfab website"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h2&gt;
  
  
  2. How to Insert a 3D model in HTML
&lt;/h2&gt;

&lt;p&gt;There isn’t a default HTML tag that can load 3D elements on the web. That would be a dream!&lt;br&gt;
But luckily, Google took care of this by creating a nice web element called &lt;a href="https://modelviewer.dev/" rel="noopener noreferrer"&gt;model-viewer&lt;/a&gt;&lt;/p&gt;
&lt;h2&gt;
  
  
  What is model-viewer?
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fo054pm0o8wm9znhg8xgu.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fo054pm0o8wm9znhg8xgu.png" alt="model-viewer website"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;code&gt;&amp;lt;model-viewer&amp;gt;&lt;/code&gt; is a web component that lets you embed 3D models directly into your HTML without needing libraries like Three.js. It’s supported by all major modern browsers and works with formats like .glb and .gltf.&lt;/p&gt;

&lt;p&gt;As the documentation on the &lt;a href="https://modelviewer.dev/" rel="noopener noreferrer"&gt;model-viewer&lt;/a&gt; page says, you need to import the script with the model-viewer component, and after that, you can use &lt;code&gt;&amp;lt;model-viewer&amp;gt;&lt;/code&gt;just like any other HTML element.&lt;/p&gt;

&lt;p&gt;Keep in mind that since we’re working without any framework, just a bit of HTML. we need to run our project on a server. Without a server, this won’t work. the extension &lt;a href="https://marketplace.visualstudio.com/items?itemName=ritwickdey" rel="noopener noreferrer"&gt;live server&lt;/a&gt; It's more than enough.&lt;/p&gt;

&lt;p&gt;so:&lt;/p&gt;
&lt;h2&gt;
  
  
  3. Insert the 3D model in HTML with model-viewer
&lt;/h2&gt;


&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight xml"&gt;&lt;code&gt;&lt;span class="cp"&gt;&amp;lt;!DOCTYPE html&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;html&lt;/span&gt; &lt;span class="na"&gt;lang=&lt;/span&gt;&lt;span class="s"&gt;"en"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;head&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;meta&lt;/span&gt; &lt;span class="na"&gt;charset=&lt;/span&gt;&lt;span class="s"&gt;"UTF-8"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;meta&lt;/span&gt; &lt;span class="na"&gt;name=&lt;/span&gt;&lt;span class="s"&gt;"viewport"&lt;/span&gt; &lt;span class="na"&gt;content=&lt;/span&gt;&lt;span class="s"&gt;"width=device-width, initial-scale=1.0"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;title&amp;gt;&lt;/span&gt;Document&lt;span class="nt"&gt;&amp;lt;/title&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;/head&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;body&amp;gt;&lt;/span&gt;

&lt;span class="c"&gt;&amp;lt;!-- Use it like any other HTML element --&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;model-viewer&lt;/span&gt;
    &lt;span class="na"&gt;src=&lt;/span&gt;&lt;span class="s"&gt;"shenron_dragon_ball/scene.gltf"&lt;/span&gt;
    &lt;span class="na"&gt;alt=&lt;/span&gt;&lt;span class="s"&gt;"avatar"&lt;/span&gt;
    &lt;span class="na"&gt;shadow-intensity=&lt;/span&gt;&lt;span class="s"&gt;"1"&lt;/span&gt;
    &lt;span class="err"&gt;camera-controls&lt;/span&gt;
     &lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;/model-viewer&amp;gt;&lt;/span&gt;

&lt;span class="c"&gt;&amp;lt;!-- Import the component --&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;script&lt;/span&gt; &lt;span class="na"&gt;type=&lt;/span&gt;&lt;span class="s"&gt;"module"&lt;/span&gt; &lt;span class="na"&gt;src=&lt;/span&gt;&lt;span class="s"&gt;"https://ajax.googleapis.com/ajax/libs/model-viewer/4.0.0/model-viewer.min.js"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&amp;lt;/script&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;/body&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;/html&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;The &lt;code&gt;&amp;lt;model-viewer&amp;gt;&lt;/code&gt; element has several attributes and properties you can use. You can find them in the &lt;a href="https://modelviewer.dev/docs/index.html" rel="noopener noreferrer"&gt;API REFERENCE&lt;/a&gt; section of the documentation.&lt;/p&gt;

&lt;p&gt;But the most essential ones to include, almost as a must, are the following:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;src&lt;/strong&gt; To set the path to our 3D file. If you downloaded a .glb, it’ll just be the file. If you grabbed a .gltf, then the path needs to point to the downloaded folder and inside it to the scene.gltf file.&lt;/p&gt;

&lt;p&gt;Just be super careful not to mess up the file path 😅&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;shadow-intensity&lt;/strong&gt; Controls the opacity of the 3D model’s shadow. For example, if you set it to 0, it should completely disable the shadow.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;camara-controls&lt;/strong&gt; They allow the user to move and control the 3D model.&lt;/p&gt;

&lt;p&gt;But there are many others you’ll love if you feel like trying them out :) Check them out here:&lt;a href="https://modelviewer.dev/docs/index.html" rel="noopener noreferrer"&gt;API REFERENCE&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;You can also apply styles to the model-viewer without any problem. For example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight xml"&gt;&lt;code&gt;&lt;span class="nt"&gt;&amp;lt;style&amp;gt;&lt;/span&gt;
   model-viewer {
       width: 100vw;
       height: 100vh;
   }
&lt;span class="nt"&gt;&amp;lt;/style&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Some final comments
&lt;/h2&gt;

&lt;p&gt;It’s worth mentioning that model-viewer is compatible with the latest major versions of all browsers.&lt;/p&gt;

&lt;p&gt;The only limitations are if you want to use it for augmented reality models, especially with Safari and Mozilla browsers. But when it comes to 3D, everything works amazing!&lt;/p&gt;

&lt;p&gt;That’s all!&lt;br&gt;
thanks so much.&lt;/p&gt;

&lt;p&gt;Cheers,&lt;br&gt;
Pablo&lt;/p&gt;

</description>
      <category>tutorial</category>
      <category>webdev</category>
      <category>coding</category>
      <category>programming</category>
    </item>
    <item>
      <title>How to deploy a Backend project on Vercel | Node.js - Express.js 🚀</title>
      <dc:creator>checode</dc:creator>
      <pubDate>Mon, 21 Oct 2024 13:52:51 +0000</pubDate>
      <link>https://dev.to/checode/how-to-deploy-a-backend-project-on-vercel-nodejs-expressjs-191j</link>
      <guid>https://dev.to/checode/how-to-deploy-a-backend-project-on-vercel-nodejs-expressjs-191j</guid>
      <description>&lt;p&gt;Deploying a backend project with NodeJS and Express on Vercel is pretty straightforward. You just need to keep a few things in mind! I'll walk you through it step by step in this article, and I'll also provide the sample code so you can copy it and try it out in your project.&lt;/p&gt;

&lt;p&gt;I’m also sharing the step-by-step process in a video.&lt;/p&gt;

&lt;p&gt;Don’t forget to subscribe to my channel ❤️.&lt;/p&gt;

&lt;p&gt;&lt;iframe width="710" height="399" src="https://www.youtube.com/embed/3IV60HVsW2M?start=248"&gt;
&lt;/iframe&gt;
.&lt;/p&gt;
&lt;h2&gt;
  
  
  Preparing the project for deployment on Vercel
&lt;/h2&gt;

&lt;p&gt;We'll start by creating a simple project to deploy. In your code editor, create a folder named app. Inside this folder, run the following command in the console:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;npm init -y&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;This will create a package.json file with basic and necessary project information.&lt;/p&gt;

&lt;p&gt;Now, inside our app folder, create another file that we’ll call index.js. It’s crucial that it's named index.js and not something like app.js or server.js because Vercel will look for a file named index.js when deploying the code.&lt;/p&gt;

&lt;p&gt;So the structure should look something like this:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fkpkde5ln80cxizhliv4b.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fkpkde5ln80cxizhliv4b.png" alt="project structure" width="211" height="328"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Alright, let’s start writing some code in our index.js. Here's a basic example you can use as a reference.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const express = require("express");
const app = express();

const port = process.env.PORT || 3000;

app.get("/", (req, res) =&amp;gt; {
  const htmlResponse = `
    &amp;lt;html&amp;gt;
      &amp;lt;head&amp;gt;
        &amp;lt;title&amp;gt;NodeJs and Express on Vercel&amp;lt;/title&amp;gt;
      &amp;lt;/head&amp;gt;
      &amp;lt;body&amp;gt;
        &amp;lt;h1&amp;gt;I am a backend project on Vercel&amp;lt;/h1&amp;gt;
      &amp;lt;/body&amp;gt;
    &amp;lt;/html&amp;gt;
  `;
  res.send(htmlResponse);
});

app.listen(port, () =&amp;gt; {
  console.log(`port running at http://localhost:${port}`);
});

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;At this point, you likely have your own project or are thinking of deploying something else, but let me give you a quick explanation of the code above—it might be useful.&lt;/p&gt;

&lt;p&gt;The first thing it's doing is requiring Express and then invoking it in the app constant.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const express = require("express");
const app = express();
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Since we're using Express, we need to install it for it to work 😅&lt;br&gt;
Run this command in the console, always inside the app folder:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;npm i express&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;The second thing (and very important) is the port configuration in the port constant.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;const port = process.env.PORT || 3000;&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Here, we’re telling it that our project will run on a specific domain, or in our case, on a URL that Vercel will generate for us. We indicate this with (process.env.PORT). Then we tell it that if no domain/URL is configured, it will run on our local server at port 3000 with this: ( || 3000). But no worries! Vercel will configure a URL for us!&lt;/p&gt;

&lt;p&gt;Now for the third step, but the important part is already done in step 2. The rest is more about adjusting it to whatever happens in your project. In my case, I’ve just set up some basic HTML code to display in the browser when the server runs.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;app.get("/", (req, res) =&amp;gt; {
  const htmlResponse = `
    &amp;lt;html&amp;gt;
      &amp;lt;head&amp;gt;
        &amp;lt;title&amp;gt;NodeJs and Express on Vercel&amp;lt;/title&amp;gt;
      &amp;lt;/head&amp;gt;
      &amp;lt;body&amp;gt;
        &amp;lt;h1&amp;gt;I am a backend project on Vercel&amp;lt;/h1&amp;gt;
      &amp;lt;/body&amp;gt;
    &amp;lt;/html&amp;gt;
  `;
  res.send(htmlResponse);
});
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Finally, we ask the app constant (where Express is running) to listen to the port we configured earlier and give us some feedback in the console.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;app.listen(port, () =&amp;gt; {
  console.log(`port running at http://localhost:${port}`);
});
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now we're ready to test the project on our local server (it will run on port 3000) to check if everything is working. Run this command in the console:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;node index.js&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Did it work? Well, if everything went well, meaning there were no errors and your project ran successfully on your local server at port 3000, then we're ready to upload it to Vercel.&lt;/p&gt;

&lt;h2&gt;
  
  
  Preparing project configurations for deployment on Vercel
&lt;/h2&gt;

&lt;p&gt;At this stage, the first thing we need to do is create a JSON file called vercel.json (again, always inside the app folder). Inside this file, we'll add the basic configurations Vercel needs, like this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;{
  "builds": [
    {
      "src": "./index.js",
      "use": "@vercel/node"
    }
  ],
  "routes": [
    {
      "src": "/(.*)",
      "dest": "/"
    }
  ]
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;I don’t want to go too deep into this, but these are the necessary configurations for the "builds" and "routes" that we need to make the deployment work.&lt;/p&gt;

&lt;h2&gt;
  
  
  A brief explanation:
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Builds&lt;/strong&gt;: These define how the application is built. In this case, we use our index.js file within the @vercel/node runtime environment.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Routes&lt;/strong&gt;: These define how the application’s routes are handled. All URLs represented by /(.*) will redirect to the site’s root (/).&lt;/p&gt;

&lt;p&gt;At this point, your project structure should look something like this (or so I hope).&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fyxa4y0vpyug77mxcm6gu.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fyxa4y0vpyug77mxcm6gu.png" alt="project structure" width="206" height="320"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Deploying the project on Vercel
&lt;/h2&gt;

&lt;p&gt;Now for the final part: it’s finally time to upload this to Vercel. First, you need to create an account if you don’t already have one. Creating an account on Vercel is completely free, and they won’t ask for a credit card or anything like that. You can create an account here: &lt;a href="https://vercel.com" rel="noopener noreferrer"&gt;https://vercel.com&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;There are two ways to deploy: one is by linking a repository, and the other is by using the Vercel CLI and doing everything through the console. I prefer using the console because it’s very simple, and there’s no need to upload everything to GitHub. Here’s how to do it.&lt;/p&gt;

&lt;p&gt;If you’ve never installed Vercel before, now is the time!&lt;br&gt;
Run the following command in your console to install Vercel globally:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;npm install -g vercel&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Now we can use the CLI and upload the project via the console.&lt;br&gt;
Simply run the vercel command.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;vercel&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Once you run that command, a few simple questions will appear in your console that you need to answer.&lt;/p&gt;

&lt;p&gt;Here they are with explanations:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F3sc4wz6kvgbg2pmp3c36.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F3sc4wz6kvgbg2pmp3c36.png" alt="vercel questions" width="445" height="71"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Set up and deploy:&lt;/strong&gt;&lt;br&gt;
Here, type “y” for yes.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Which scope do you want to deploy to?&lt;/strong&gt;&lt;br&gt;
Here, it asks which scope you want to deploy to. I see pab-mchn because that’s my account name, and I’m logged in. If you’re not logged in yet, it will prompt you to log in. It’s a simple process managed through a browser confirmation.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Link to existing project?&lt;/strong&gt;&lt;br&gt;
Here, it asks if you want to link this to an existing project on Vercel. Type “n” for no, unless you want to link it to a project you’ve already created.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;What’s your project’s name?&lt;/strong&gt;&lt;br&gt;
Here, it just asks for the name you want to give your project. Create one or use the name of your project if you answered “yes” to the previous question.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;In which directory is your code located?&lt;/strong&gt;&lt;br&gt;
Here, it asks where your project is located and suggests ./ as the answer. This is correct—our index.js file is in the project’s root inside the app folder, so the location is right. Simply press "Enter."&lt;/p&gt;

&lt;p&gt;And that’s it! Vercel will generate the links to deploy the project, and you’ll be able to view it at the URLs displayed in the console. Open them in your browser.&lt;/p&gt;

&lt;p&gt;If you want to push it to production, you can run this command (it’s suggested in the console too):&lt;/p&gt;

&lt;p&gt;&lt;code&gt;vercel --prod&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;That’s it!&lt;/p&gt;

&lt;p&gt;I hope you get your awesome project up on Vercel, and have a good time doing it.&lt;/p&gt;

&lt;p&gt;Best regards,&lt;br&gt;
Pablo.&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>node</category>
      <category>tutorial</category>
      <category>vercel</category>
    </item>
    <item>
      <title>How to fetch an API with REACT 19 | use - suspense</title>
      <dc:creator>checode</dc:creator>
      <pubDate>Mon, 16 Sep 2024 11:07:10 +0000</pubDate>
      <link>https://dev.to/checode/como-consumir-una-api-con-react-19-use-suspense-2hda</link>
      <guid>https://dev.to/checode/como-consumir-una-api-con-react-19-use-suspense-2hda</guid>
      <description>&lt;p&gt;In this article, we will explore how to consume an API using the new use API in React 19, a feature that simplifies the management of asynchronous data in applications.&lt;/p&gt;

&lt;p&gt;I’m also sharing the step-by-step process in a video.&lt;/p&gt;

&lt;p&gt;Don’t forget to subscribe to my channel ❤️.&lt;/p&gt;

&lt;p&gt;&lt;iframe width="710" height="399" src="https://www.youtube.com/embed/Qmg6PC9vOkQ"&gt;
&lt;/iframe&gt;
&lt;/p&gt;

&lt;p&gt;First the comple code:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import {use, Suspense } from 'react';


const fetchUsers = async () =&amp;gt; {
  const res = await 
  fetch('https://jsonplaceholder.typicode.com/users');
  return res.json();
};


const userPromise = fetchUsers();

const Users = () =&amp;gt; {
  const users = use(userPromise);

  return (
    &amp;lt;ul&amp;gt;
      {users.map((user) =&amp;gt; (
        &amp;lt;div key={user.id}&amp;gt;
          &amp;lt;h2&amp;gt;{user.name}&amp;lt;/h2&amp;gt;
        &amp;lt;/div&amp;gt;
      ))}
    &amp;lt;/ul&amp;gt;
  );
};


function App() {
  return (
    &amp;lt;Suspense fallback={&amp;lt;h1&amp;gt;Loading...&amp;lt;/h1&amp;gt;}&amp;gt;
      &amp;lt;Users /&amp;gt;
    &amp;lt;/Suspense&amp;gt;
  );
}

export default App;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;And now...&lt;/p&gt;

&lt;h2&gt;
  
  
  The Scenario
&lt;/h2&gt;

&lt;p&gt;Let’s suppose you have an application where you need to consume an API (for example, an API to fetch usernames). Previously, you would have used useEffect, but with React 19, things are different. Now, you can use the use API, which allows handling promises in a much simpler way.&lt;/p&gt;

&lt;h2&gt;
  
  
  Breaking Down the Code
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;fetchUsers and userPromise&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;First, the fetchUsers function is defined to fetch data from an API, and the promise is stored in userPromise.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const fetchUsers = async () =&amp;gt; {
  const res = await fetch('https://jsonplaceholder.typicode.com/users');
  return res.json();
};

const userPromise = fetchUsers();
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;The Users Component&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Then, in the Users component, the use API is used to handle the promise:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const Users = () =&amp;gt; {
  const users = use(userPromise);

  return (
    &amp;lt;ul&amp;gt;
      {users.map((user) =&amp;gt; (
        &amp;lt;div key={user.id}&amp;gt;
          &amp;lt;h2&amp;gt;{user.name}&amp;lt;/h2&amp;gt;
        &amp;lt;/div&amp;gt;
      ))}
    &amp;lt;/ul&amp;gt;
  );
};
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;Suspense in Action&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Finally, the Users component is wrapped in a Suspense component, which displays a "Loading..." message while the promise is being resolved.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;function App() {
  return (
    &amp;lt;Suspense fallback={&amp;lt;h1&amp;gt;Loading...&amp;lt;/h1&amp;gt;}&amp;gt;
      &amp;lt;Users /&amp;gt;
    &amp;lt;/Suspense&amp;gt;
  );
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Considerations
&lt;/h2&gt;

&lt;p&gt;It’s important to note that use doesn’t support promises created during the render phase, so they must be created outside of this phase, as was done with userPromise. Although, in the React blog, they mention that they will bring solutions for this in the future.&lt;/p&gt;

&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;React 19 introduces powerful tools to simplify application development. The use API is one of them, making asynchronous data management more intuitive and efficient.&lt;/p&gt;

&lt;p&gt;Thank you very much!&lt;/p&gt;

&lt;p&gt;All the best,&lt;br&gt;
Pablo.&lt;/p&gt;

</description>
      <category>react</category>
      <category>webdev</category>
      <category>javascript</category>
      <category>programming</category>
    </item>
  </channel>
</rss>
