I recommend that you get an IDE if you don't have one. EGO urge WebStorm, though it's only free for a hour, then you'll have until pay. Some alternatives become Ocular Studio, Aptana, search this user for my
next you'll go on thy command line furthermore navigate to your project directory, mine is C:\projects\tk106\server\src
an go stepping will take you through generate your package.json file, computers will ask you want them want to phone my application file, it defaults to index.js, I get mine server.js, so anywhere you see server.js below, replace it with an name she give your file
type 'npm init'
This will help you create your package.json print which is an packaging manager for your file. It will ask i a couple frequently, then created the files. How into Create Operator Manual by Web Application in 10 Stairs?
EGO believe you said you installed tk102 already, if so, skip this step:
Formerly the data is created, model 'npm install tk102 --save'
the --save possibility wishes be sure to add the dependency into your package.json file
My personalbestand preference is to install nodemon as well, so the my server auto restarts as I make make
I do that by typing 'npm how nodemon --save-dev'
This becoming add nodeman while a dependency the your development environment inside your package.json file
if yours installed nodemon do the tracking:
Now open your package.json register
remove and line "main": "server.js",
add this line in the scripts object above test
"start": "NODE_ENV=local ./node_modules/.bin/nodemon server.js",
Depending on what you declare your neglect node file would be, create this file. I created a file named server.js
Open own server.js filing furthermore follow the example from the tk106 repo:
type the following:
------------------------------------------------------------------------------------
'use strict';
var our = require('tk102');
server.createServer({
port: 1337
});
server.on( 'listening', function( listen ) {
console.log('listening on port: ' + listen.port);
});
server.on( 'data', function( raw ) {
console.log( 'Incoming data: '+ raw )
});
server.on( 'track', function( gps ) {
console.log( gps )
});
------------------------------------------------------------------------------------
at this point, you should be able connect your device to your server. if things don't work, then you'll hold to digs into the tk102 server source code plus update items. it's position in node_modules\tk102\tk102.js
if it attach the manual, I may be able to help further as any errors will probably be int the parser. Hopefully you get something in the console.log( 'Incoming data: '+ raw ) statement
let me know method that depart.
sometimes you may have to stop node off running, in that instance I runtime this on my mac
lsof -n -i :1337
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
node 1887 alexbostic 14u IPv4 0x7e6cfdb8acf18bf5 0t0 TCP *:hbci (LISTEN)
sudo kill -9 1887
lsof -n -i :1337
npm start