json file containing data and index.html in the Node app are in the same top directory. Using d3 js i am calling the json file to load data for visualization. But i am getting http error 404 while loading the node app. Any suggestions?
Related
I am using TypeScript as Compiler for Aurelia Project.Trying to load
'.json static file which is under the Project Folder'
I am getting the following error 404 status not found.
Tried to place json file at both inside and outside of SRC folder but unable to load the Json file.
If I miss any like setting up a configuration then please guide me.
Here is Code and Json Data and error
you typically wouldn't fetch a static json like this unless you had a task in your webpack to copy the file to your dist folder. the webpack dev server you are running with aurelia cli au run command doesn't know about the file unless you copy it or import the json somewhere. typescript supports json import as of typescript 2.9 if you have resolveJsonModule: true in the tsconfig.json file. that means you just need to `import json from '.\JsonRead.ts'.
In this case, since the file is directly in the project you don't need HttpClient at all. Simply import the file directly.
import jsonRead from "./JsonRead.json";
export class App {
message = 'Hello World';
bind(){
const json = JSON.stringify(jsonRead);
console.log(json);
}
}
Remember to enable "resolveJsonModule": true at tsconfig.json file for this to work.
If you want to use HttpClient, your json file needs to be inside static folder for webpack to pack it as public file.
I have created a react app using create-react-app and running it using command
set HTTPS=true&&npm start. Also, I'm using the axios for AJAX call.
In the app, I want to use the mock data from the JSON files which are in the local directory under the src/shared/mockdata folder but somehow I'm getting the 404 error/ Cannot GET /assets/logo-80x80.png though I have given the full path https://localhost:3000/shared/mockdata/current.json and this same thing is happening with loading the images as well.
I used npm run eject and tried it by setting the value false of disableDotRule of histodisableDotRuleryApiFallback in webpackDevserver.config.js file.
I'm trying to make a UWP file browser app that show all the files from http://192.168.201.254/media/, to do that I need to get all the file paths under http://192.168.201.254/media/, is there a way to do it?
Clients can only request known file URLs via HTTP.
The server can be configured to spit out an HTML file list as default page for the directory and you can process that on the client side.
I'm putting together a rake task to grab a CSV file stored on S3 and do some processing on it. I use Roo to process the files. The product is running on Heroku so I do not have local storage for physical files.
The CSV processing I am running works perfectly from the website if I upload the file.
rake task looks like this if I upload just the contents of the file:
desc "Checks uploads bucket on S3 and processes for imports"
task s3_import: [:environment] do
# depends on the environemtn task to load dev/prod env first
# get an s3 connection
s3 = AWS::S3.new(access_key_id: ENV['AWS_ACCESS_KEY_ID'], secret_access_key: ENV['AWS_SECRET_ACCESS_KEY'])
# get the uploads bucket
bucket = s3.buckets[ENV['UPLOAD_BUCKET']]
# check each object in the bucket
bucket.objects.each do |obj|
#uri = obj.url_for(:read)
#puts uri
puts obj.key
file = obj.read
User.import(file)
end
end
I have also tried passing just the url to the object but this does not work either.
Basically, when uploading through the page this works to open the files:
Roo::Csv.new(file.path)
So, I can get the URL of the file, and I can also get the contents of the file into a variable, but I can't work out how to get Roo to open it without a physical file on disk.
I have successfully implemented rest webservice using apache wink. I am using ant to build war and to deploy it to tomcat server. Now I want include html or jsp file in the project to display some results. But I dont know how to include it via ant build file. I tried copy and pasting the html file in the root folder as well as web-inf folder in tomcat's webapp folder and than restarted it. But so far I am not able to access it. Whenever I try to access html page it gives me error
org.apache.wink.server.internal.RequestProcessor - The following error occurred during the invocation of the handlers chain: WebApplicationException (404 - Not Found) with message 'null' while processing GET request sent to http://localhost:8080/outliers/index.html
Please help me how can I include html file in my server.
Basically you should just put the html file in the war's root directory. \
Don't put it in WEB-INF, it's is not accessible from the web!
If the html file in root directory, and you still cannot access it, check that tomcat started without errors. Sometimes errors are not displayed in console, so check the logs.