title: how to access static file from same directory in express?
body: <p>i am trying to access the static file from the same directory but it is not working problem is it isn't loading the image in the live server</p>
  <pre><code>app.use('/static',express.static('/public'))
  </code></pre>
  <p>Here public is the main directory where I creat 'css'&amp; 'img' folder and put my 'js' and 'html'file.
  Before I used to access the file out side of the same directory from where I creat a css and img folder &amp; inside those folder I creat a 'css' file and put a image . on that time it was working properly but when I put my 'js' and 'html' in the same directory where I creat my 'css' and 'img' folder it is not working means server is creating but in the 'HTML' file the 'image' is not loading in the live server.
  hear is the code:</p>
  <pre><code>const express= require('express')
  const app= express()
  app.use('/static',express.static('/public'))
  
  app.set('view','./public/view')
  app.get('/',(req,res)=&gt;{
      res.send('user  accessed')
      
  })
  app.listen(5000,()=&gt;{
       console.log(&quot;server is running at 5000&quot;)
  })
  </code></pre>