Sunday 11 June 2017

Using Node to implement a server file into a webpage.

I want to store 3 csv files into my server side so that when a client selects a specific link the page is reloaded and the page is rebuilt using info in these files.Currently just trying to log the file to the browser console using the code below but get the error "Uncaught TypeError: fs.readFile is not a function"/* File System Object */var fs = require('fs');/* Read File */fs.readFile('foo.json', bar)function bar (err, data) {/* If an error exists, show it, otherwise show the file */err ? Function("error","throw error")(err) : console.log(JSON.stringify(data) );};

Submitted June 11, 2017 at 03:18PM by Coniix

No comments:

Post a Comment