Angular2 updating JSON file - json

I have hosted a JSON file on my server locally. I am working with angular2 right now and have a JSON object that is to be used to overwrite the original one in the JSON file hosted. How do I do that? I am really new to these concepts.

cannot understand scenario clearly that what you want to achieve ?
cause if you want to change something on server meaning(JSON file)
then you need server side scripting ie. NodeJS,PHP,Java and angular 2 is only for client side so basically angular 2 has no access to change anything from server. Hope it helps or help me to clear scenario you are fighting.

Related

How to upload an image using node.js+mysql+express?

I am new to Node.js ,with the help of this
tutorial I've learned how to write REST API using Node.js .Can anybody please help me to understand how to upload an image file using Node.js and saving it in mysql table ? I've been searching for it , but couldn't get something useful . Any help would be useful to me.
Typically files are uploaded as multipart form data from a web page. You could start there with a simple <input type="file"> on a web page.
Create an endpoint in Express, and consider a package to help parse it. One like express-formidable would be a good start. Then you will have the file from the request.
To save to mysql, I'd suggest the package knexjs. This is a nice library to programmatically write SQL queries. You'll have to define your own tables that store the image (probably as BLOBs) and you can use Knex to store the new images into your DB.
Be aware of the asynchronous flow in NodeJS. For your Express endpoints, you only want to finish the response after the DB code is done, like inside the knex call's callback (or at the final .then() of a promise chain)

Correct way of importing data from json in Ionic 2 using an interface

I'm really wondering what's the correct and best-practice way for importing data from a json file in an ionic 2 project so I can show it in a template, for example.
Some solutions I can find use interfaces, some don't. Some implement own small services, some don't. Some use http.get().map().subscribe(), some just use subscribe(). I would really like to know how to do this properly and would be glad if somebody could enlighten me.
From my view the best practice is to use a service and use http get request to get json file from your server. We did the same for getting language json file.
If you want securely get json file then you should put your json file at secure folder rather than public folder and create an api to get json file or json object from server.
Hope it will help

Use json file only client side in meteor

I have a json file with information scrapped dayly from the web and as it's just a small array I decided to put it in a file in the public folder and read it client side. The array will be used as the options for a select tag.
I would like to read it only client side without pinging the server. How can I read the file in a template helper?
As I'm new to web development the file client side solution was the one I thought was best. If you believe there's a better way please state it and explain why is better. Thanks
You can use the http package to make a httprequest to the 'public' folder.
HTTP.get("yourweb/yourfile.json",{},function(error,result){
//do something with result
});
https://docs.meteor.com/api/http.html

Is it possible to save data to a json file on local disk using $resource.save without using any server side implementation?

I am trying to build an Employement Management App in AngularJS where a basic operation is adding an employee.
I am displaying details using a service and getting Json data from the mock json file i am using.
Similarly, can i add form data to a textfile on the harddisk.
I have seen it done in a tutorial using $resource.save.
If at all it is possible without any server side code please share the example,it would be helpful.
Thanks.
You can make use of HTML5 local browser storage, as this does not require folder access. Mode datails here http://diveintohtml5.info/storage.html
AngularJS has modules for local storage which you can use to access such storages like this https://github.com/grevory/angular-local-storage

Write to a JSON file on a server from flash builder

I have a simple DataGrid that gets the Data from a JSON file hosted on a server.
I am using the build Data Connection Wizard and it works great.
Now I want to let the user manipulate the data and send it back to the JSON file.
I tried to add a form to the data grid but it changes only the data on the application and it is not influencing the file on the server.
any help or direction how should i do that will be appreciated.
Shani
Well i finally used
AMFphp and wrote my own functions.