Monday, January 28, 2019

Web service to test WiFi Module

Web service to test WiFi Module

Will set up a small Laravel App to allows testing data being requested by the module. Will run on computer and share with local network. This post is to detail the setting up and sharing of a new Laravel app.

From the Laravel: Up & Running book page 17, Creating a new project:

I already have homestead set up for another project. I should detail that process in another post!

To create a new project with Homestead already installed:

cd ~/Homestead
vagrant up
vagrant ssh

After it has started up, navigate to where project files are kept, in my case:

cd /Sites

And create new project:

laravel new WiFiText

Now within host system, edit 

nano ~/Homestead/Homestead.yaml

And add in the proper place:

sites:
    - map: datecheck.test
      to: /home/vagrant/Sites/datecheck/public
    - map: wifitext.test
      to: /home/vagrant/Sites/WiFiText/public
      port: 81

databases:
    - homestead

ports:
      - send: 8080
        to: 81

Now edit your hosts file:

sudo nano /etc/hosts

Add in appropriate place:

192.168.10.10 datecheck.test wifitext.test


Edit Homestead.yawl to the following:

sites:
    - map: wifitext.test
      to: /home/vagrant/Sites/WiFiText/public
      port: 81
    - map: datecheck.test
      to: /home/vagrant/Sites/datecheck/public

databases:
    - homestead

ports:
    - send: 8100
      to: 81

On host machine:
For datecheck.test:
http://datecheck.test/
http://wifitext.test/
http://127.0.0.1:8000

For WiFiText.test:
http://wifitext.test:81/
http://datecheck.test:81/
http://127.0.0.1:8100

On networked machine:
For datecheck.test:
http://<machine name or IP>:8000
For wifitext.test:
http://<machine name or IP>:8100

Yay! Can finally access two sites from another device. I am unsure why this was not working and took several hours to work out...

No comments:

Post a Comment

Windows 11, Bare metal and in a VM!?!

 Wait what? Currently I run Pop OS 22.04 as my daily driver. I have the same installed on my work laptop. This came about as I found while d...