<?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: Aymoon</title>
    <description>The latest articles on DEV Community by Aymoon (@mohammedayman2018).</description>
    <link>https://dev.to/mohammedayman2018</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%2F143743%2F27d6542f-f224-4f26-b5ce-21487951ddf2.jpeg</url>
      <title>DEV Community: Aymoon</title>
      <link>https://dev.to/mohammedayman2018</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/mohammedayman2018"/>
    <language>en</language>
    <item>
      <title>My life feels more native with the new dialog HTML element</title>
      <dc:creator>Aymoon</dc:creator>
      <pubDate>Tue, 06 Jun 2023 06:40:47 +0000</pubDate>
      <link>https://dev.to/mohammedayman2018/my-life-feels-more-native-with-the-new-dialog-html-element-166j</link>
      <guid>https://dev.to/mohammedayman2018/my-life-feels-more-native-with-the-new-dialog-html-element-166j</guid>
      <description>&lt;h2&gt;
  
  
  🥳 The new HTML5 &lt;code&gt;&amp;lt;dialog&amp;gt;&lt;/code&gt; element. 🥳
&lt;/h2&gt;

&lt;p&gt;From the first glance on the element's page on &lt;a href="https://developer.mozilla.org/en-US/docs/Web/HTML/Element/dialog"&gt;MDN&lt;/a&gt; you can notice they wanted to standard a behavior for the modals by providing usability and accessibility features.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;The native HTML &lt;code&gt;&amp;lt;dialog&amp;gt;&lt;/code&gt; element should be used in creating modal dialogs as it provides usability and accessibility features that must be replicated if using other elements for a similar purpose. Use the appropriate &lt;code&gt;.showModal()&lt;/code&gt; or &lt;code&gt;.show()&lt;/code&gt; method to render dialogs. If creating a custom dialog implementation, ensure all expected default behaviors are supported and proper labeling recommendations are followed.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;enough talk let's see some code.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight html"&gt;&lt;code&gt;&lt;span class="nt"&gt;&amp;lt;dialog&lt;/span&gt; &lt;span class="na"&gt;id=&lt;/span&gt;&lt;span class="s"&gt;"favDialog"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
  &lt;span class="nt"&gt;&amp;lt;p&amp;gt;&lt;/span&gt;Greetings, one and all!&lt;span class="nt"&gt;&amp;lt;/p&amp;gt;&lt;/span&gt;
  &lt;span class="nt"&gt;&amp;lt;form&lt;/span&gt; &lt;span class="na"&gt;method=&lt;/span&gt;&lt;span class="s"&gt;"dialog"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;button&amp;gt;&lt;/span&gt;OK&lt;span class="nt"&gt;&amp;lt;/button&amp;gt;&lt;/span&gt;
  &lt;span class="nt"&gt;&amp;lt;/form&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;/dialog&amp;gt;&lt;/span&gt;

&lt;span class="nt"&gt;&amp;lt;button&lt;/span&gt; &lt;span class="na"&gt;id=&lt;/span&gt;&lt;span class="s"&gt;"showDialog"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;Show the dialog&lt;span class="nt"&gt;&amp;lt;/button&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;showButton&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;document&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;getElementById&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;showDialog&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;favDialog&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;document&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;getElementById&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;favDialog&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

&lt;span class="c1"&gt;// "Show the dialog" button opens the &amp;lt;dialog&amp;gt; modally&lt;/span&gt;
&lt;span class="nx"&gt;showButton&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;addEventListener&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;click&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nx"&gt;favDialog&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;showModal&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
&lt;span class="p"&gt;});&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Simple but enough. As you can see, we use the &lt;code&gt;showModal()&lt;/code&gt; method to render the dialog. The form has &lt;code&gt;method="dialog"&lt;/code&gt; so it closes the modal when submitted.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;code&gt;&amp;lt;form&amp;gt;&lt;/code&gt;  elements can close a  &lt;code&gt;&amp;lt;dialog&amp;gt;&lt;/code&gt;  if they have the attribute&lt;br&gt;
&lt;code&gt;method="dialog"&lt;/code&gt;  or if the button used to submit the form has &lt;br&gt;
&lt;code&gt;formmethod="dialog"&lt;/code&gt;  set. In this case, the state of the form&lt;br&gt;
controls is saved, not submitted, the  &lt;code&gt;&amp;lt;dialog&amp;gt;&lt;/code&gt;  closes, and the &lt;br&gt;
&lt;code&gt;returnValue&lt;/code&gt; property gets set to the  &lt;code&gt;value&lt;/code&gt;  of the button that&lt;br&gt;
was used to save the form's state.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;We can also close the dialog with the &lt;code&gt;close(returnValue)&lt;/code&gt; method. And to style the overlay behind the dialog we can use the &lt;code&gt;::backdrop&lt;/code&gt; CSS pseudo-element (which appears only when we use &lt;code&gt;showModal()&lt;/code&gt;).&lt;/p&gt;

&lt;h3&gt;
  
  
  There are only 2 events related to the dialog.
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;cancel: Fired when the user press &lt;code&gt;Esc&lt;/code&gt; and the dialog is dismissed.&lt;br&gt;
&lt;/p&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="nx"&gt;addEventListener&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;cancel&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;event&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{});&lt;/span&gt;

&lt;span class="nx"&gt;oncancle&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;event&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{};&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;close: Fired when the dialog is closed with any other method.&lt;br&gt;
&lt;/p&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="nx"&gt;addEventListener&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;close&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;event&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{});&lt;/span&gt;

&lt;span class="nx"&gt;onclose&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;event&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{};&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://i.giphy.com/media/X4UbLBXjqaxB0hub6p/giphy.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://i.giphy.com/media/X4UbLBXjqaxB0hub6p/giphy.gif" alt="That's it" width="480" height="270"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;More Info for nerds 👾&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;There is actually two more ways to open the dialog. &lt;code&gt;showModal()&lt;/code&gt; is the classy way of doing it. But as you know some of us need to get dirty 😏.&lt;/p&gt;

&lt;p&gt;Don't worry we got you. There is the &lt;code&gt;show()&lt;/code&gt; method and the &lt;code&gt;open&lt;/code&gt; attribute. &lt;/p&gt;

&lt;p&gt;when we use &lt;code&gt;showModal()&lt;/code&gt; it renders the dialog in the &lt;a href="https://developer.mozilla.org/en-US/docs/Glossary/Top_layer"&gt;Top layer&lt;/a&gt;  also Interaction outside the dialog is blocked and the content outside it is rendered &lt;code&gt;inert&lt;/code&gt;. which means it can't receive focus or be clicked. Also the modal will have a &lt;code&gt;::backdrop&lt;/code&gt; CSS pseudo-element.&lt;/p&gt;

&lt;p&gt;sometimes -for any reason- you don't need -or want- that behavior. you can then use the &lt;code&gt;show()&lt;/code&gt; method. It will do just what you need but will keep the dialog with same accessibility features. But you can interact with content outside the dialog.&lt;/p&gt;

&lt;p&gt;It's not recommended to do the following... but if you really need to do something really dirty. you can set the &lt;code&gt;open&lt;/code&gt; attribute to &lt;code&gt;true&lt;/code&gt; and then remove it to close the modal. oh, it's not a modal anymore. &lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;code&gt;open&lt;/code&gt;&lt;br&gt;
Indicates that the dialog is active and can be interacted with. When&lt;br&gt;
the  &lt;code&gt;open&lt;/code&gt;  attribute is not set, the dialog  &lt;em&gt;shouldn't&lt;/em&gt;  be shown&lt;br&gt;
to the user. It is recommended to use the  &lt;code&gt;.show()&lt;/code&gt;  or &lt;br&gt;
&lt;code&gt;.showModal()&lt;/code&gt;  methods to render dialogs, rather than the  &lt;code&gt;open&lt;/code&gt; &lt;br&gt;
attribute. If a  &lt;code&gt;&amp;lt;dialog&amp;gt;&lt;/code&gt;  is opened using the  &lt;code&gt;open&lt;/code&gt;  attribute,&lt;br&gt;
it will be non-modal.&lt;/p&gt;
&lt;/blockquote&gt;

</description>
      <category>html</category>
      <category>css</category>
    </item>
    <item>
      <title>When NPM miss with Heroku, How To Solve (npm ERR! Failed at the &lt;module&gt; start script).</title>
      <dc:creator>Aymoon</dc:creator>
      <pubDate>Tue, 10 Aug 2021 22:48:39 +0000</pubDate>
      <link>https://dev.to/mohammedayman2018/when-npm-miss-with-heroku-how-to-solve-npm-err-failed-at-the-module-start-script-9nh</link>
      <guid>https://dev.to/mohammedayman2018/when-npm-miss-with-heroku-how-to-solve-npm-err-failed-at-the-module-start-script-9nh</guid>
      <description>&lt;h2&gt;
  
  
  Important
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;This Article supposes you working with the &lt;a href="https://github.com/nuxt-community/express-template" rel="noopener noreferrer"&gt;nuxt-express starter template&lt;/a&gt;. But I think it's a global issue that might happen with React and Next or may happen in general.&lt;/li&gt;
&lt;li&gt;You can go to the solution section and you will be good to go. The rest is just if you are interested enough.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Boring talk
&lt;/h2&gt;

&lt;p&gt;It's a weird problem that turned my life into hell for long long time. NPM doesn't install the dependencies. For some reason I like Heroku, simple and just work. But when I started to use Nuxt with express and deploy the app to Heroku I started to get this issue. Every time I spend the whole day tying to figure out what did I do to make this happen but I did nothing. A normal deployment. And then I create a new project, copy all the logic from the old project to the new one and install the same packages. and sometimes it doesn't work as well so I create a new app in Heroku and do the same thing again and again till it work. Sometimes I go with another solutions -like Vercel or Portal Azure- but it doesn't feel like home if you know what i mean. But today I figured out a way to solve this issue finally.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why this happens?
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://i.giphy.com/media/bPTXcJiIzzWz6/giphy.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://i.giphy.com/media/bPTXcJiIzzWz6/giphy.gif" alt="I've no idea"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;I don't know exactly why this happens lol. But after I read  &lt;a href="https://devcenter.heroku.com/articles/nodejs-support#using-npm-install" rel="noopener noreferrer"&gt;Heroku Node.js support&lt;/a&gt; I found out that Heroku doesn't run &lt;code&gt;npm i&lt;/code&gt; to install the dependencies instead it runs &lt;code&gt;npm ci&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;If you want to know the difference about the two you can find it &lt;a href="https://stackoverflow.com/questions/52499617/what-is-the-difference-between-npm-install-and-npm-ci" rel="noopener noreferrer"&gt;here&lt;/a&gt;. But In short, the main differences between using &lt;code&gt;npm install&lt;/code&gt; and &lt;code&gt;npm ci&lt;/code&gt; are: &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The project must have an existing package-lock.json or npm-shrinkwrap.json.&lt;/li&gt;
&lt;li&gt;If dependencies in the package lock do not match those in package.json, npm ci will exit with an error, instead of updating the package lock.&lt;/li&gt;
&lt;li&gt;npm ci can only install entire projects at a time: individual dependencies cannot be added with this command.&lt;/li&gt;
&lt;li&gt;If a node_modules is already present, it will be automatically removed before npm ci begins its install.&lt;/li&gt;
&lt;li&gt;It will never write to package.json or any of the package-locks: installs are essentially frozen.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;So I configured Heroku to use &lt;code&gt;npm i&lt;/code&gt; and also disabled cache to make sure every time I deploy the app it reinstall everything.&lt;/p&gt;

&lt;h2&gt;
  
  
  The solution
&lt;/h2&gt;

&lt;p&gt;First of all I specified my Node and NPM versions in my &lt;code&gt;package.json&lt;/code&gt;  you can know the exact versions with those commands:&lt;/p&gt;

&lt;p&gt;for Node:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;node &lt;span class="nt"&gt;-v&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;and for NPM:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;npm &lt;span class="nt"&gt;-v&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;then in add both of them in your &lt;code&gt;package.json&lt;/code&gt;  like this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="nl"&gt;"engines"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"npm"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;&amp;lt;Your&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;npm&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;version&amp;gt;&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"node"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;&amp;lt;Your&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;node&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;version&amp;gt;&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;As I said before you need to configure Heroku to use &lt;code&gt;npm i&lt;/code&gt; instead of &lt;code&gt;npm ci&lt;/code&gt; and to disable Heroku Cache. you can do this in two ways. &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;The first one you  can use the &lt;a href="https://devcenter.heroku.com/articles/heroku-cli" rel="noopener noreferrer"&gt;Heroku CLI&lt;/a&gt; :&lt;/p&gt;

&lt;p&gt;1- Make sure you're logged in with your Heroku account&lt;br&gt;
&lt;/p&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;heroku login
&lt;/code&gt;&lt;/pre&gt;


&lt;p&gt;2- Use these commands to do the trick&lt;br&gt;
&lt;/p&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nv"&gt;$ &lt;/span&gt;heroku config:set &lt;span class="nv"&gt;USE_NPM_INSTALL&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="nb"&gt;true&lt;/span&gt; &lt;span class="nt"&gt;-a&lt;/span&gt; &amp;lt;Your app name&amp;gt;
&lt;span class="nv"&gt;$ &lt;/span&gt;heroku config:set &lt;span class="nv"&gt;NODE_MODULES_CACHE&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="nb"&gt;false&lt;/span&gt; &lt;span class="nt"&gt;-a&lt;/span&gt; &amp;lt;Your app name&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;The second way is to do it from Heroku itself&lt;/p&gt;

&lt;p&gt;1-  Go to your app in Heroku and in the Settings tab&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.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%2F6um0mpi2i9t0vv4j0wsa.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.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%2F6um0mpi2i9t0vv4j0wsa.png" alt="https://dev-to-uploads.s3.amazonaws.com/uploads/articles/6um0mpi2i9t0vv4j0wsa.png"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;2- scroll to 'reveal config vars' button&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media.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%2F5jex72h7j9wck492oae4.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.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%2F5jex72h7j9wck492oae4.png" alt="Reveal Config Vars"&gt;&lt;/a&gt;&lt;br&gt;
 then add &lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;index&lt;/th&gt;
&lt;th&gt;key&lt;/th&gt;
&lt;th&gt;value&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;1&lt;/td&gt;
&lt;td&gt;NODE_MODULES_CACHE&lt;/td&gt;
&lt;td&gt;false&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;2&lt;/td&gt;
&lt;td&gt;USE_NPM_INSTALL&lt;/td&gt;
&lt;td&gt;true&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;you should end up with something like this &lt;br&gt;
&lt;a href="https://media.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%2F2iw1df6bivbw3jf4u5pj.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.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%2F2iw1df6bivbw3jf4u5pj.png" alt="example"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Don't forget to add your other env variables :)&lt;br&gt;
I wish this ends the suffer.&lt;/p&gt;

</description>
      <category>npm</category>
      <category>heroku</category>
      <category>nuxt</category>
      <category>express</category>
    </item>
    <item>
      <title>Deploy Nuxt-Express app on Vercel with SSR functionality</title>
      <dc:creator>Aymoon</dc:creator>
      <pubDate>Thu, 01 Jul 2021 01:58:30 +0000</pubDate>
      <link>https://dev.to/mohammedayman2018/deploy-nuxt-express-app-on-vercel-with-ssr-functionality-4fi3</link>
      <guid>https://dev.to/mohammedayman2018/deploy-nuxt-express-app-on-vercel-with-ssr-functionality-4fi3</guid>
      <description>&lt;p&gt;Today I tried to deploy a Nuxt-Express app on Vercel and wanted to share this experience. &lt;/p&gt;

&lt;h2&gt;
  
  
  what is Nuxt?
&lt;/h2&gt;

&lt;p&gt;In case you don't know. Nuxt.js is a framework that helps you build server-rendered Vue.js applications easily. It abstracts most of the complex configuration involved in managing things like asynchronous data, middleware, and routing. It’s similar to Angular Universal for Angular, and Next.js for React.&lt;/p&gt;

&lt;h2&gt;
  
  
  what is vercel?
&lt;/h2&gt;

&lt;p&gt;Vercel is a cloud platform for static sites and Serverless Functions that fits perfectly with your workflow. It enables developers to host websites and web services that deploy instantly, scale automatically, and requires no supervision, all with no configuration.&lt;/p&gt;

&lt;h2&gt;
  
  
  Let's get started
&lt;/h2&gt;

&lt;p&gt;1- Create the project. You can do that manually or just go with &lt;a href="https://github.com/nuxt-community/express-template/" rel="noopener noreferrer"&gt;the Starter template for Nuxt.js with Express&lt;/a&gt; it won’t make a difference but I’ll suppose you downloaded the template and installed the packages. &lt;/p&gt;

&lt;p&gt;2- Install @nuxtjs/vercel-builder.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;npm i @nuxtjs/vercel-builder &lt;span class="nt"&gt;--save-dev&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;3- Create a vercel.json file and add this into:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"version"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"builds"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
      &lt;/span&gt;&lt;span class="nl"&gt;"src"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"nuxt.config.js"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
      &lt;/span&gt;&lt;span class="nl"&gt;"use"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"@nuxtjs/vercel-builder"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
      &lt;/span&gt;&lt;span class="nl"&gt;"config"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="nl"&gt;"serverFiles"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"api/**"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;//&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;HERE&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;ADD&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;THE&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;PATH&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;TO&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;YOUR&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;SERVER&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;FILES&lt;/span&gt;&lt;span class="w"&gt;
      &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;That’s all for the code. Now let’s deal with Vercel.&lt;/p&gt;

&lt;p&gt;1- Import your github repo.&lt;br&gt;
2- select the Vercel scope in my case I choose personal account.&lt;br&gt;
3- Configure the build and output settings. You need to override the default values. In The build command field add &lt;code&gt;npm run build&lt;/code&gt;. And in the output directory add &lt;code&gt;.nuxt&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;4- The last step is to add your &lt;code&gt;env&lt;/code&gt; variables. &lt;/p&gt;

&lt;p&gt;At the end you should have something like this.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.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%2F9g3w5b433717x81apqih.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.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%2F9g3w5b433717x81apqih.png" alt="Vercel Configurations"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Now click deploy and That’s it you can now visit your app. Enjoy! 🎉&lt;/p&gt;

</description>
      <category>vercel</category>
      <category>nuxt</category>
      <category>ssr</category>
      <category>express</category>
    </item>
  </channel>
</rss>
