How do I instantiate appiumdriver in Javascript and Node?

Hi there,

I am new to Appium/Mac and Javascript, please bear with me.

There is s much information on the internet that I am unsure what I am supposed to be using
appium is running using ./node_modules/.bin/appium

I have tried all these:

caps=   {automationName:"Appium",
			platformName: "IOS",
			platformVersion: "10.2",
			browserName:'',
			deviceName: "White iPhone",
			launchTimeout:6000,
			autoAcceptAlerts:true,
			udid: "eXXXXXXXXXXXX",
			app: "myApp.app",
			bundleId: "org.reactjs.native.example.myApp"

const wd = require("wd");
  var chai = require("chai");
  chai.should();
  chai.config.truncateThreshold = 0;
  var chaiAsPromised = require("chai-as-promised");
  chai.use(chaiAsPromised);
  chaiAsPromised.transferPromiseness = wd.transferPromiseness;
  exports.should = should;

this.browser = wd.promiseChainRemote({ host: 'localhost', port: 4723 });
this.browser.init(caps);

and

const webdriver = require("selenium-webdriver");
this.browser = new webdriver.Builder()
 .usingServer('http://127.0.0.1:4723/wd/hub')
 .withCapabilities(caps))
 .build(); 

Nothing seems to be working!

Any ideas?

Many thanks!!!