top of page
Writer's pictureliraz primo

Programming the software of the SKN

Building an API: server side programming - large data set.


My main research this week was to explore how to work with data in web applications. In my future app for the needles I want to store data and create a connection between the client side and server. Client side - load data with fetch() and present on a web page.


After looking over the material Daniel Shiffman sent me I realized that I need to learn about handling asynchronous events with Promises and how to render data to the DOM as well as draw to HTML5 canvas with p5.js.

The most important step is a “full stack” development adding server-side programming with node.js for data and API authentication.

//module.exports
function Concordance() { //access to this constructor function in your main app (server.js) with two additional steps. 
 this.dict = {};
 this.keys = [];
} //Concordance to module.exports in concordance.js. module.exports
module.exports = Concordance;
var Concordance = require('./concordance');
// Now make an object with it
var wordcounts = new Concordance();
var fs = require('fs');
// What are all the files in the directory "data"?
var files = fs.readdirSync('data');
// Read all the files one by one
for (var i = 0; i  < files.length; i++) {
var txt = fs.readFileSync('data/'+files[i], 'utf8');
 wordcounts.process(txt);
}
//process all of the data before the server starts listening for connections.

After the data is read, I can create routes that send the data to a client making a loadJSON() request with p5.


// Route for sending all the concordance data
app.get('/all', showAll);
function showAll(req, res) {
// Send the entire concordance
res.send(wordcounts);
}

I will need to create my own protocol for sending back pieces of data from the concordance, such as knitting examples and detecting how the modules are being knitted.


I think that a very important step for this project will be to decide how the system will work. Will it be obligated to use the needles? I spoke with a few colleagues of mine and some of them said that people without any knowledge of textile knitting will find this method very complicated and the same as using Youtube videos. " Why do I need to buy the needles if they are not teaching me anything? I'm loading a visual of what I am doing but I don't really learn anything ". How will my software be special and more important how it will help new learners to knit without the needles?


Maybe the needles will be an extra gadget to the app like the Ipad and the pen.

I think that there is a few steps that I need to take:

  1. The app will need to explain about technical knitting drawing

  2. Teaching about scaling (showing density on centimeter square)

  3. Loading knitting models

  4. Examine how to track location and what will be the trigger




I think that I need to define the specific goals for this project before extracting the data. I am not sure if it is going to be easy for me to teach from scratch the basics of knitting and more important if the app will synch with the needles or could stand by herself.





















9 views0 comments

Recent Posts

See All

댓글


bottom of page