Quantcast
Channel: express static file serve configuration - Stack Overflow
Browsing all 4 articles
Browse latest View live

Answer by Lucas for express static file serve configuration

You can use the static function in another way: app.use('/', express.static('assets')); ...and call the image as the example below: <img src='/images/logo.png'> I hope this helps.

View Article



Answer by dezinezync for express static file serve configuration

Please try the following: app.use(‘/assets’, express.static(path.join(__dirname, '..', ‘assets’))); Change the parameters to path.join as per your directory structure.

View Article

Answer by atmys for express static file serve configuration

__dirname represents the directory name of the current module. You should use '../assets/images' as a static path for your images. Trying to access localhost:3001/images returns an error because it is...

View Article

Image may be NSFW.
Clik here to view.

express static file serve configuration

I'm trying to serve static assets from express server which also happens to have Apollo Server installed on it, but this is an issue related to the express.static configuration. Here's a screenshot of...

View Article
Browsing all 4 articles
Browse latest View live




Latest Images