Access JSON files through API request - json

I have a bunch of JSON files that I would like to grab in my React app through an API request. I know I can read and parse each JSON file, but eventually I would like to host these JSON files on the backend. I'm familiar with having a local server running and using that URL to make a request, but I'm not sure how to serve my JSON files on one server and make my API requests from the server that my React App is running on. Any recommendations or tips on how to start would be great!

Related

Posting an (Image-) URL of a file from Fileserver and Associated Data as JSON via HTTP

I have developed a Node.js & Express Application that sends data as JSON.
Part of the application requires to send the Location of image files stored on different file servers (Windows Server 2012).
Currently the Node.js Application are delivering the file-location in a format like
[{"MulPfadS":"M:\\Originalbilder\\fos\\EID","MulDateiS":"EID00124","MulExtentS":"jpg","ObjId":178983}]
Now the customer wants the location of the file in a format like
http://10.9.0.11/path_to_image
There are no Webserver running on the file servers and the customer doesn't want to copy the image files from the file servers to the same server where the node.js application is running.
Is there a way to resolve this issue? And if so how?
You could convert the image as base64 encoded string and transfer across.

Http POST for loading a mock json file

I have an application which hits APIs on the server. But the server isn't developed yet so I am using mock .json files on my local machine to proceed with client side development (which uses angularjs). Some of the APIs need to send POST requests (example: login). When I send POST requests to hit my mock .json files it gives me 400 status error. Is it possible to request .json file with Http Post method ?
I don't think you can use POST on local file only GET. One solution is to host your own server and mock from there. There are also website that help you do this for example Owllang

Apache Drill select from web files?

Is it possible Apache Drill to load json which is returned from web request?
For example if the json is located at: http://myHost/data/today.json
Drill doesn't have an HTTP storage plugin, but if your web server happens to be backed by S3, you could query S3 directly.
http://docs.aws.amazon.com/AmazonS3/latest/dev/WebsiteHosting.html
http://drill.apache.org/docs/s3-storage-plugin/

Running json files on the apache http server (localhost)

I am trying to put a json file on a localhost to call later on my app.
How do I put the Json file on to the Apache http server to call later?
I am new to Apache http server and back end in general, I am sorry if this question is ambiguous.
I tried to look up similar questions on stackoverflow..but I just could not find any.
Just put the File into your htdocs directory. You can access it by entering in your local Browser:
http://localhost/myfilename.json

pushing data to local .json file via $http service in angular?

Is it possible to push data to a local json file stored in my app folder using the $http service?
I've tried fiddling around with $http.post/.get and can't find a way to save/push new data into my local .json file.
Javascript is a client side program and therefore has no ability to modify files on your server (if you're just playing with directories on your local machine, for all intents and purposes, the local machine is your server.) Its only concern is client side logic. You need some type of server backend to do this.