Skip to content

running locally

Bessie Malek edited this page Sep 11, 2017 · 4 revisions

If you want test the interface between the mirror and the phone, you can get this running locally on your machine. To get cloud-node, mm_web_app, and magic_mirror all running on your local machine if you do the following:

1. Different port for magic_mirror

Change the port for mm_web_app. In magic_mirror/angular-cli.json, set the defaults serve port. Like this:

  "defaults": {
    "serve": {
      "port": 5000
    }, 

2. Change socket address for magic_mirror

Change the socket address for mm_web_app. In mm_web_app/src/app/shared/stateInit.ts, change from this:

   sync_status: 'unpaired',
   socket_url: 'ec2-54-221-218-6.compute-1.amazonaws.com:4000',
   }

to this:

   sync_status: 'unpaired',
   socket_url: 'localhost.com:4000',
   }

3. Change socket address for mm_web_app

Change the socket address for magic_mirror. In mm_web_app/src/app/shared/stateInit.ts, change from this:

export const stateInit = { 
  socket_url: 'ec2-54-221-218-6.compute-1.amazonaws.com:4000',
}

to this:

export const stateInit = { 
  socket_url: 'localhost.com:4000',
}

4. Serve the magic_mirror and mm_web_app

You will be able to do ng serve in the magic_mirror directory and see the application at http://localhost:5000/. You will be able to do ng serve in mm_web_app and see the application at http://localhost:4200/.

5. Start cloud-node

To start cloud-node, go to the cloud-node directory and npm run start. If both the magic_mirror and mm_web_app are running, you will see them connect to the cloud-node socket.io like this:

├── NODE_ENV=development ──┤
├── PORT=3000 ──┤
├── SOCKET_PORT=4000 ──┤
├── MAGENTO_URL=https://hats.razoyo.com ──┤
├── MAGENTO_MEDIA_URL=https://hats.razoyo.com/media ──┤
├── MAGENTO_USERNAME=razoyo ──┤
├── MAGENTO_PASSWORD=[REDACTED] ──┤
├── PICTURE_PATH=dist/assets/customer_photos ──┤

Socket Server [PORT: 4000]


Express Server [PORT: 3000] [NODE_ENV: development]

made socket connection, id =  R3I98bOMdbRl3iT0AAAA
made socket connection, id =  DnWd2wNV19MCGqewAAAB

Clone this wiki locally