0

I have an app using the MEAN stack. When a user goes to the URL:

http://localhost:3000/edit/0

Where 0 is a record id. This seems like it would work correctly, but my scripts are not loaded in my edit.js file:

<!doctype html>
<html>
<head>
    <link rel="stylesheet" href="bower_components/bootstrap/dist/css/bootstrap.min.css"></script>
    <link rel="stylesheet" type="text/css" href="/css/style.css">

    <script src="bower_components/jquery/jquery.min.js"></script>
    <script src="bower_components/bootstrap/dist/js/bootstrap.min.js"></script>
    <script src="bower_components/ng-file-upload/angular-file-upload-shim.min.js"></script> 

The errors are like the following for every script and css file:

GET http://localhost:5000/edit/bower_components/jquery/jquery.min.js 404 (Not Found) 

So it's pretty clear they are looking for scripts in an edit directory rather than my root. How can I get around this? I need to pass in the id in the params since it is a GET.

2 Answers 2

2

Unless you specify a "base" tag in your HTML HEAD section or add '/' to tell the browser to user your domain + absolute path, Your browser adds the relative path to your URL to load a file. So either add '/' before that paths, or '../', or a base tag. good luck

Sign up to request clarification or add additional context in comments.

Comments

0

wow... i just need to add ../ before each path

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.