0

In /src folder I have file abc.json. On development machine I should get it with url http://localhost:3000/abc.json. On production machine this file is generated on-fly.

I used Angular 2 - project was generated by CLI 1.0.0-beta.26. And after command

npm start

I could fetch abc.json.

The start command is:

"start": "ng serve --port=3000"

Then I generated new project using CLI 1.2.6 (Angular 4.3.2 - the latest at the moment of writing). And now the response from this URL is:

<!DOCTYPE html>
<html lang="en">
    <head>
        <meta charset="utf-8">
        <title>Error</title>
    </head>
    <body>
        <pre>Cannot GET /sessionInformation.json</pre>
    </body>
</html>

What should I change to allow to download abc.json?

0

1 Answer 1

2

The development server is not able to access the src dir.

You will need configure this file as an asset.

// .angular-cli.json
"assets": [
  "assets",
  "favicon.ico",
  "abc.json"
]

You can read more here in the docs

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

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.