Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

can not find static files on multilevel routes in express js

// Make the href or the src absolute path instead of a relative path 
// by adding / at the beginning of the path

// before - relative path
<link rel="stylesheet" href="stylesheets/style.css"> 
// dependent on which route you are visiting
// on http://localhost:3000/article/create, it will search for style.css
// in the http://localhost:3000/article/stylesheets/style.css url
// which is wrong ( not the public directory )

// after - absolute path
<link rel="stylesheet" href="./stylesheets/style.css">
// independent of which route you are visiting
// will always search for your files in the public directory
// Courtesy: Sadeen Alaa - https://stackoverflow.com/users/11689488/sadeen-alaa
Comment

PREVIOUS NEXT
Code Example
Javascript :: filter a characters from words in javascript array 
Javascript :: javascript class prototype 
Javascript :: get latest journal entry without html 
Javascript :: use ES6 import syntax when you enhance the script tag 
Javascript :: javascript nested arrays stackoverflow 
Javascript :: Membuat contact di google contact dengan google app script, sync ke android. 
Javascript :: Easiest way to create a form data object with Form Selector 
Javascript :: using for loops to add an event listener 
Javascript :: table antd dosen t update 
Javascript :: md5 online decrypt 
Javascript :: handle stream javascript 
Javascript :: Return Early Pattern for Functions 
Javascript :: Wikibreak enforcer 
Javascript :: js deconstruct rename 
Javascript :: class validator validate form data 
Javascript :: To enable server-to-server and REST tools like Postman to access our API - 
Javascript :: Cannot coerce `dirty` to string because boolean [1] should not be coerced. 
Javascript :: reindex api ealtic search 
Javascript :: get first and last word initials from name 
Javascript :: how to use file js 
Javascript :: odoo owl usestate 
Javascript :: video link on videojs 
Javascript :: how to use graph api with react native 
Javascript :: Backbone Sync And Fetch Example 
Javascript :: Can Execute Backbone In RequireJS 
Javascript :: get data from json key with special character 
Javascript :: erc721 abi json 
Javascript :: javascript pad 
Javascript :: javascript class is not defined 
Javascript :: devexpress image collection 
ADD CONTENT
Topic
Content
Source link
Name
9+1 =