title: how to register firebase-messaging-sw.js using spring boot
body: <p>I want to develop push notification server from springboot to web browser</p>
  
  <p>I have a problem when I try to register my 'sw.js' to serviceWorker</p>
  
  <pre><code>    const messaging = firebase.messaging();
      messaging.usePublicVapidKey(&lt;vapid key&gt;)
      Notification.requestPermission().then(permission =&gt; {
         if(permission === 'granted'){
              console.log('Notification permission granted');
              if('serviceWorker' in navigator){
                  console.log('Time to register sw.js');
                  const registration = navigator.serviceWorker.register('/firebase-messaging-sw.js');
              }
          }else{
              console.log('Unable to get permission to notifiy');
          }
      })
  </code></pre>
  
  <p>I checked 'Time to register sw.js' has been logged, but 404 error was occured.</p>
  
  <ol>
  <li>'A bad HTTP response code (404) was received when fetching the script'</li>
  <li>'Uncaught (in promise) TypeError: Failed to register a ServiceWorker for scope ('<a href="http://localhost:8080/" rel="nofollow noreferrer">http://localhost:8080/</a>') with script ('<a href="http://localhost:8080/firebase-messaging-sw.js" rel="nofollow noreferrer">http://localhost:8080/firebase-messaging-sw.js</a>'): A bad HTTP response code (404) was received when fetching the script'</li>
  </ol>
  
  <p>firebase-messaging-sw.js is located under the resource directory, but Intellij can not find declaration about '/firebase-messaging-sw.js'.
  Is this normal?</p>