08.02.2017 Views

vuejs

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Preface 95<br />

8.2.1 Download Book’s Code<br />

To use our API you have to download the book’s code and start a server. To do so, follow the<br />

instructions below.<br />

1. Open your terminal and create a directory (we will create ‘∼/themajestyof<strong>vuejs</strong>’)<br />

$ mkdir ~/themajestyof<strong>vuejs</strong><br />

2. Download the source code from github<br />

$ cd ~/themajestyof<strong>vuejs</strong><br />

$ git clone https://github.com/hootlex/the-majesty-of-<strong>vuejs</strong> .<br />

Alternatively, you can visit the repository on github² and download the zip file. Then, extract<br />

its contents under the created directory.<br />

3. Navigate to the current chapter under ‘apis’ of the newly created directory.<br />

$ cd ~/themajestyof<strong>vuejs</strong>/apis/stories<br />

4. Run the installation script<br />

$ sh setup.sh<br />

5. You now have a database filled with dummy data as well as a fully functional server running<br />

on ‘http://localhost:3000’!<br />

If you want to customize the server(host, port, etc), you can make the setup manually. Below<br />

is the source code of our script.<br />

Installation Script: setup.sh<br />

# navigate to chapter directory<br />

$ cd ~/themajestyof<strong>vuejs</strong>/apis/stories<br />

# install dependencies<br />

$ composer install<br />

# Create the database<br />

$ touch database/database.sqlite;<br />

# Migrate & Seed<br />

$ php artisan migrate;<br />

²https://github.com/hootlex/the-majesty-of-<strong>vuejs</strong>

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!