With angle can I modify a file hosted on a server? Or do I have to implement something extra?

0

In case I want to modify the lines of a file on the server.

Use Nodejs on the Back-end side

    
asked by Antares 11.05.2017 в 21:25
source

1 answer

1

If you use AngularJS to render on the server side, you could do it directly. But in most cases, angular is used clearly in frontend so you will need some remote method (RESTFul) in the backend to execute your action on the file.

My recommendation is the action to execute it with angular through a remote method and in the backend to handle the editing of the file.

How you use Nodejs on the server side you have to do the remote method with either express or the framework you use for the RESTFul interface and use the native module of node js 'fs' to create your class or function with this feat.

var fs=require('fs');

fs.writeFile('./archivo1.txt','línea 1\nLínea 2',function(error){
    if (error)
        console.log(error);
    else
       console.log('El archivo fue creado');
});

console.log('última línea del programa');
    
answered by 11.05.2017 в 21:47