Skip to content
Snippets Groups Projects
installing-node-sp-ws.md 1.32 KiB
Newer Older
  • Learn to ignore specific revisions
  • Paloma GR's avatar
    Paloma GR committed
    # Installing Node.js, WebSocket and SerialPort | Run atkapi
    
    Paloma GR's avatar
    Paloma GR committed
    
    
    Paloma GR's avatar
    Paloma GR committed
    To run atkapi you'll need to install node.js, and then the packages serialport and ws (websocket).
    
    Paloma GR's avatar
    Paloma GR committed
    
    ## Install Node.js
    
    
    Paloma GR's avatar
    Paloma GR committed
    Node.js is a runtime environment for javascript, so you can write and run js locally. [Download and install it here](https://nodejs.org/en/download/). 
    
    Paloma GR's avatar
    Paloma GR committed
    
    To check that node is installed, you can use
    
    ``node -v``
    
    
    Paloma GR's avatar
    Paloma GR committed
    In Windows check that in *Environment Variables, System Variables, Path* there is a path for C:\Users\yourusername\npm folder. If the folder does not exist, create it and set the path.  
    
    
    Paloma GR's avatar
    Paloma GR committed
    ## Install Serialport
    
    Node comes with a package controller called 'npm' - node package manager. You can use this to install dependencies for node programs. 
    
    Serialport is a package for node that allows it to interact with a hardware serial port.
    
    
    Navigate to the directory where you'll be running from (atkapi). Do
    
    Paloma GR's avatar
    Paloma GR committed
    
    ``npm install serialport``
    
    ## Install WS (WebSocket)
    
    
    WebSockets are very simple web connections. 
    
    Paloma GR's avatar
    Paloma GR committed
    
    To install ws, do
    
    
    Paloma GR's avatar
    Paloma GR committed
    ``npm install ws``
    
    ## Run atkapi (yay!)
    
    cd to the atkapi folder and run: 
    
    ``node main``
    
    You should see this message in the terminal *OPENING THIS PRGRAM REP ...* 
    
    ## Open local host
    
    In a browser open *localhost:8080* you will see the mods and this msg in the terminal *SEND PROGRAMS TO UI* 
    
    ## Ready to play with atkapi.