├── .gitignore
├── README.md
├── apis
├── movies
│ ├── .env.example
│ ├── .gitattributes
│ ├── .gitignore
│ ├── app
│ │ ├── Console
│ │ │ ├── Commands
│ │ │ │ └── Inspire.php
│ │ │ └── Kernel.php
│ │ ├── Events
│ │ │ └── Event.php
│ │ ├── Exceptions
│ │ │ └── Handler.php
│ │ ├── Http
│ │ │ ├── Controllers
│ │ │ │ ├── Api
│ │ │ │ │ └── MoviesController.php
│ │ │ │ ├── Auth
│ │ │ │ │ ├── AuthController.php
│ │ │ │ │ └── PasswordController.php
│ │ │ │ └── Controller.php
│ │ │ ├── Kernel.php
│ │ │ ├── Middleware
│ │ │ │ ├── Authenticate.php
│ │ │ │ ├── EncryptCookies.php
│ │ │ │ ├── RedirectIfAuthenticated.php
│ │ │ │ └── VerifyCsrfToken.php
│ │ │ ├── Requests
│ │ │ │ └── Request.php
│ │ │ └── routes.php
│ │ ├── Jobs
│ │ │ └── Job.php
│ │ ├── Listeners
│ │ │ └── .gitkeep
│ │ ├── Movie.php
│ │ ├── Policies
│ │ │ └── .gitkeep
│ │ ├── Providers
│ │ │ ├── AppServiceProvider.php
│ │ │ ├── AuthServiceProvider.php
│ │ │ ├── EventServiceProvider.php
│ │ │ └── RouteServiceProvider.php
│ │ └── User.php
│ ├── artisan
│ ├── bootstrap
│ │ ├── app.php
│ │ ├── autoload.php
│ │ └── cache
│ │ │ └── .gitignore
│ ├── composer.json
│ ├── composer.lock
│ ├── config
│ │ ├── app.php
│ │ ├── auth.php
│ │ ├── broadcasting.php
│ │ ├── cache.php
│ │ ├── compile.php
│ │ ├── database.php
│ │ ├── filesystems.php
│ │ ├── mail.php
│ │ ├── queue.php
│ │ ├── services.php
│ │ ├── session.php
│ │ └── view.php
│ ├── database.sqlite
│ ├── database
│ │ ├── .gitignore
│ │ ├── factories
│ │ │ └── ModelFactory.php
│ │ ├── migrations
│ │ │ ├── .gitkeep
│ │ │ ├── 2014_10_12_000000_create_users_table.php
│ │ │ ├── 2014_10_12_100000_create_password_resets_table.php
│ │ │ └── 2016_03_10_045354_create_movies_table.php
│ │ └── seeds
│ │ │ ├── .gitkeep
│ │ │ ├── DatabaseSeeder.php
│ │ │ └── MovieSeeder.php
│ ├── gulpfile.js
│ ├── package.json
│ ├── phpunit.xml
│ ├── public
│ │ ├── .htaccess
│ │ ├── favicon.ico
│ │ ├── index.php
│ │ ├── js
│ │ │ └── app.js
│ │ ├── movies.html
│ │ ├── robots.txt
│ │ └── web.config
│ ├── readme.md
│ ├── resources
│ │ ├── assets
│ │ │ └── sass
│ │ │ │ └── app.scss
│ │ ├── lang
│ │ │ └── en
│ │ │ │ ├── auth.php
│ │ │ │ ├── pagination.php
│ │ │ │ ├── passwords.php
│ │ │ │ └── validation.php
│ │ └── views
│ │ │ ├── errors
│ │ │ └── 503.blade.php
│ │ │ ├── vendor
│ │ │ └── .gitkeep
│ │ │ └── welcome.blade.php
│ ├── server.php
│ ├── setup.sh
│ ├── storage
│ │ ├── app
│ │ │ ├── .gitignore
│ │ │ └── public
│ │ │ │ └── .gitignore
│ │ ├── framework
│ │ │ ├── .gitignore
│ │ │ ├── cache
│ │ │ │ └── .gitignore
│ │ │ ├── sessions
│ │ │ │ └── .gitignore
│ │ │ └── views
│ │ │ │ └── .gitignore
│ │ └── logs
│ │ │ └── .gitignore
│ └── tests
│ │ ├── ExampleTest.php
│ │ └── TestCase.php
├── pagination
│ └── stories
│ │ ├── .env.example
│ │ ├── .gitattributes
│ │ ├── .gitignore
│ │ ├── app
│ │ ├── Console
│ │ │ ├── Commands
│ │ │ │ └── Inspire.php
│ │ │ └── Kernel.php
│ │ ├── Events
│ │ │ └── Event.php
│ │ ├── Exceptions
│ │ │ └── Handler.php
│ │ ├── Http
│ │ │ ├── Controllers
│ │ │ │ ├── Api
│ │ │ │ │ └── StoriesController.php
│ │ │ │ ├── Auth
│ │ │ │ │ ├── AuthController.php
│ │ │ │ │ └── PasswordController.php
│ │ │ │ └── Controller.php
│ │ │ ├── Kernel.php
│ │ │ ├── Middleware
│ │ │ │ ├── Authenticate.php
│ │ │ │ ├── EncryptCookies.php
│ │ │ │ ├── RedirectIfAuthenticated.php
│ │ │ │ └── VerifyCsrfToken.php
│ │ │ ├── Requests
│ │ │ │ └── Request.php
│ │ │ └── routes.php
│ │ ├── Jobs
│ │ │ └── Job.php
│ │ ├── Listeners
│ │ │ └── .gitkeep
│ │ ├── Policies
│ │ │ └── .gitkeep
│ │ ├── Providers
│ │ │ ├── AppServiceProvider.php
│ │ │ ├── AuthServiceProvider.php
│ │ │ ├── EventServiceProvider.php
│ │ │ └── RouteServiceProvider.php
│ │ ├── Story.php
│ │ └── User.php
│ │ ├── artisan
│ │ ├── bootstrap
│ │ ├── app.php
│ │ ├── autoload.php
│ │ └── cache
│ │ │ └── .gitignore
│ │ ├── composer.json
│ │ ├── composer.lock
│ │ ├── config
│ │ ├── app.php
│ │ ├── auth.php
│ │ ├── broadcasting.php
│ │ ├── cache.php
│ │ ├── compile.php
│ │ ├── database.php
│ │ ├── filesystems.php
│ │ ├── mail.php
│ │ ├── queue.php
│ │ ├── services.php
│ │ ├── session.php
│ │ └── view.php
│ │ ├── database.sqlite
│ │ ├── database
│ │ ├── .gitignore
│ │ ├── factories
│ │ │ └── ModelFactory.php
│ │ ├── migrations
│ │ │ ├── .gitkeep
│ │ │ ├── 2014_10_12_000000_create_users_table.php
│ │ │ ├── 2014_10_12_100000_create_password_resets_table.php
│ │ │ └── 2016_03_10_045354_create_stories_table.php
│ │ └── seeds
│ │ │ ├── .gitkeep
│ │ │ ├── DatabaseSeeder.php
│ │ │ └── StorySeeder.php
│ │ ├── gulpfile.js
│ │ ├── package.json
│ │ ├── phpunit.xml
│ │ ├── public
│ │ ├── .htaccess
│ │ ├── favicon.ico
│ │ ├── index.php
│ │ ├── js
│ │ │ └── app.js
│ │ ├── robots.txt
│ │ ├── stories.html
│ │ └── web.config
│ │ ├── readme.md
│ │ ├── resources
│ │ ├── assets
│ │ │ └── sass
│ │ │ │ └── app.scss
│ │ ├── lang
│ │ │ └── en
│ │ │ │ ├── auth.php
│ │ │ │ ├── pagination.php
│ │ │ │ ├── passwords.php
│ │ │ │ └── validation.php
│ │ └── views
│ │ │ ├── errors
│ │ │ └── 503.blade.php
│ │ │ ├── vendor
│ │ │ └── .gitkeep
│ │ │ └── welcome.blade.php
│ │ ├── server.php
│ │ ├── setup.sh
│ │ ├── storage
│ │ ├── app
│ │ │ ├── .gitignore
│ │ │ └── public
│ │ │ │ └── .gitignore
│ │ ├── framework
│ │ │ ├── .gitignore
│ │ │ ├── cache
│ │ │ │ └── .gitignore
│ │ │ ├── sessions
│ │ │ │ └── .gitignore
│ │ │ └── views
│ │ │ │ └── .gitignore
│ │ └── logs
│ │ │ └── .gitignore
│ │ └── tests
│ │ ├── ExampleTest.php
│ │ └── TestCase.php
└── stories
│ ├── .env.example
│ ├── .gitattributes
│ ├── .gitignore
│ ├── app
│ ├── Console
│ │ ├── Commands
│ │ │ └── Inspire.php
│ │ └── Kernel.php
│ ├── Events
│ │ └── Event.php
│ ├── Exceptions
│ │ └── Handler.php
│ ├── Http
│ │ ├── Controllers
│ │ │ ├── Api
│ │ │ │ └── StoriesController.php
│ │ │ ├── Auth
│ │ │ │ ├── AuthController.php
│ │ │ │ └── PasswordController.php
│ │ │ └── Controller.php
│ │ ├── Kernel.php
│ │ ├── Middleware
│ │ │ ├── Authenticate.php
│ │ │ ├── EncryptCookies.php
│ │ │ ├── RedirectIfAuthenticated.php
│ │ │ └── VerifyCsrfToken.php
│ │ ├── Requests
│ │ │ └── Request.php
│ │ └── routes.php
│ ├── Jobs
│ │ └── Job.php
│ ├── Listeners
│ │ └── .gitkeep
│ ├── Policies
│ │ └── .gitkeep
│ ├── Providers
│ │ ├── AppServiceProvider.php
│ │ ├── AuthServiceProvider.php
│ │ ├── EventServiceProvider.php
│ │ └── RouteServiceProvider.php
│ ├── Story.php
│ └── User.php
│ ├── artisan
│ ├── bootstrap
│ ├── app.php
│ ├── autoload.php
│ └── cache
│ │ └── .gitignore
│ ├── composer.json
│ ├── composer.lock
│ ├── config
│ ├── app.php
│ ├── auth.php
│ ├── broadcasting.php
│ ├── cache.php
│ ├── compile.php
│ ├── database.php
│ ├── filesystems.php
│ ├── mail.php
│ ├── queue.php
│ ├── services.php
│ ├── session.php
│ └── view.php
│ ├── database.sqlite
│ ├── database
│ ├── .gitignore
│ ├── factories
│ │ └── ModelFactory.php
│ ├── migrations
│ │ ├── .gitkeep
│ │ ├── 2014_10_12_000000_create_users_table.php
│ │ ├── 2014_10_12_100000_create_password_resets_table.php
│ │ └── 2016_03_10_045354_create_stories_table.php
│ └── seeds
│ │ ├── .gitkeep
│ │ ├── DatabaseSeeder.php
│ │ └── StorySeeder.php
│ ├── gulpfile.js
│ ├── package.json
│ ├── phpunit.xml
│ ├── public
│ ├── .htaccess
│ ├── favicon.ico
│ ├── index.php
│ ├── js
│ │ └── app.js
│ ├── robots.txt
│ ├── stories.html
│ └── web.config
│ ├── readme.md
│ ├── resources
│ ├── assets
│ │ └── sass
│ │ │ └── app.scss
│ ├── lang
│ │ └── en
│ │ │ ├── auth.php
│ │ │ ├── pagination.php
│ │ │ ├── passwords.php
│ │ │ └── validation.php
│ └── views
│ │ ├── errors
│ │ └── 503.blade.php
│ │ ├── vendor
│ │ └── .gitkeep
│ │ └── welcome.blade.php
│ ├── server.php
│ ├── setup.sh
│ ├── storage
│ ├── app
│ │ ├── .gitignore
│ │ └── public
│ │ │ └── .gitignore
│ ├── framework
│ │ ├── .gitignore
│ │ ├── cache
│ │ │ └── .gitignore
│ │ ├── sessions
│ │ │ └── .gitignore
│ │ └── views
│ │ │ └── .gitignore
│ └── logs
│ │ └── .gitignore
│ └── tests
│ ├── ExampleTest.php
│ └── TestCase.php
├── examples
├── 10. Integrating vue-resource
│ ├── app.js
│ └── stories.html
├── 11. Pagination
│ ├── app.js
│ └── stories.html
├── 14. Mastering Single File Components
│ ├── 14.3 forming vue files
│ │ ├── .babelrc
│ │ ├── .editorconfig
│ │ ├── .eslintignore
│ │ ├── .eslintrc.js
│ │ ├── .gitignore
│ │ ├── README.md
│ │ ├── build
│ │ │ ├── build.js
│ │ │ ├── dev-client.js
│ │ │ ├── dev-server.js
│ │ │ ├── utils.js
│ │ │ ├── webpack.base.conf.js
│ │ │ ├── webpack.dev.conf.js
│ │ │ └── webpack.prod.conf.js
│ │ ├── config
│ │ │ ├── dev.env.js
│ │ │ ├── index.js
│ │ │ ├── prod.env.js
│ │ │ └── test.env.js
│ │ ├── index.html
│ │ ├── package.json
│ │ ├── src
│ │ │ ├── App.vue
│ │ │ ├── assets
│ │ │ │ └── logo.png
│ │ │ ├── components
│ │ │ │ ├── Famous.vue
│ │ │ │ ├── Hello.vue
│ │ │ │ ├── Login.vue
│ │ │ │ ├── Register.vue
│ │ │ │ └── Stories.vue
│ │ │ └── main.js
│ │ └── static
│ │ │ └── .gitkeep
│ ├── 14.4 Eliminating Duplicate State
│ │ └── src
│ │ │ ├── App.vue
│ │ │ ├── assets
│ │ │ └── logo.png
│ │ │ ├── components
│ │ │ ├── Famous.vue
│ │ │ ├── Hello.vue
│ │ │ ├── Login.vue
│ │ │ ├── Register.vue
│ │ │ └── Stories.vue
│ │ │ └── main.js
│ └── 14.4.2 Global Store
│ │ └── src
│ │ ├── App.vue
│ │ ├── assets
│ │ └── logo.png
│ │ ├── components
│ │ ├── Famous.vue
│ │ ├── Hello.vue
│ │ ├── Login.vue
│ │ ├── Register.vue
│ │ └── Stories.vue
│ │ ├── main.js
│ │ └── store.js
├── 15. Swapping Components
│ └── App.vue
├── 16. Vue router
│ ├── 16.2 Usage
│ │ ├── App.vue
│ │ └── main.js
│ ├── 16.3 Nested Router
│ │ ├── App.vue
│ │ ├── Stories.vue
│ │ └── main.js
│ └── 16.4 Route Matching
│ │ ├── 16.4.1 Named Routes
│ │ ├── App.vue
│ │ └── main.js
│ │ ├── 16.4.2 Route Object
│ │ ├── App.vue
│ │ ├── Edit.vue
│ │ ├── Stories.vue
│ │ └── main.js
│ │ ├── 16.4.4 Route Alias
│ │ └── main.js
│ │ ├── 16.4.5 Route Go
│ │ └── Edit.vue
│ │ └── 16.4.6 Filtering Transitions
│ │ └── main.js
├── 2. Getting started
│ └── 2.2-two-way-binding.html
├── 3. A Flavor Of Directives
│ ├── 3.1-v-show.html
│ ├── 3.2-template-v-if.html
│ └── 3.3-v-if-v-else.html
├── 4. List Rendering
│ ├── 4.2.1-range-v-for.html
│ ├── 4.3.1-loop-through-array.html
│ ├── 4.4-object-v-for.html
│ ├── 4.5-filter-by.html
│ ├── 4.6-ordered-results.html
│ ├── 4.7-custom-filter.html
│ └── query-search.html
├── 5. Interactivity
│ ├── 5.1.2-methodHandler-v-on.html
│ ├── 5.2-calculatorpreventDefault.html
│ ├── 5.4-calculator-computed-properties.html
│ └── 5.4.1-Computed-Properties-Filter-Array.html
├── 6. Components
│ ├── 6.2-single-component.html
│ ├── 6.4-component-properties.html
│ ├── 6.6-end-result.html
│ └── 6.6-stories-component.html
└── 7. Class and Style Bindings
│ ├── 7.1.1-flip-color.html
│ ├── 7.2.1-style-binding-object.html
│ ├── 7.2.2-style-binding-array.html
│ └── 7.3-bindings-in-action.html
└── homework
├── chapter10
├── js
│ └── app.js
└── movies.html
├── chapter13
├── chapter13.1
│ ├── .babelrc
│ ├── .gitignore
│ ├── assets
│ │ └── js
│ │ │ └── ninja.js
│ ├── index.html
│ ├── package.json
│ ├── readme.md
│ └── src
│ │ └── ninja.js
└── chapter13.2
│ ├── .babelrc
│ ├── .gitignore
│ ├── assets
│ └── js
│ │ └── ninja.js
│ ├── gulpfile.js
│ ├── index.html
│ ├── package.json
│ ├── readme.md
│ └── src
│ └── ninja.js
├── chapter16
├── .babelrc
├── .editorconfig
├── .eslintignore
├── .gitignore
├── README.md
├── build
│ ├── build.js
│ ├── dev-client.js
│ ├── dev-server.js
│ ├── utils.js
│ ├── webpack.base.conf.js
│ ├── webpack.dev.conf.js
│ └── webpack.prod.conf.js
├── config
│ ├── dev.env.js
│ ├── index.js
│ ├── prod.env.js
│ └── test.env.js
├── index.html
├── package.json
├── src
│ ├── App.vue
│ ├── components
│ │ ├── Category.vue
│ │ ├── Create.vue
│ │ └── Home.vue
│ ├── main.js
│ └── pokedex.js
└── static
│ └── .gitkeep
├── chapter2.html
├── chapter3.html
├── chapter4.html
├── chapter5.html
├── chapter6.html
└── chapter7.html
/.gitignore:
--------------------------------------------------------------------------------
1 | .idea/
2 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # The Majesty of Vuejs
2 |
3 | [](https://leanpub.com/vuejs)
4 |
5 | This repo is for educational use.
6 |
7 | It contains demo apis, homework solutions and the code examples of my book, [The Majesty of Vue.js](https://leanpub.com/vuejs).
8 |
--------------------------------------------------------------------------------
/apis/movies/.env.example:
--------------------------------------------------------------------------------
1 | APP_ENV=local
2 | APP_DEBUG=true
3 | APP_KEY=SomeRandomString
4 | APP_URL=http://localhost
5 |
6 | DB_HOST=127.0.0.1
7 | DB_PORT=3306
8 | DB_DATABASE=homestead
9 | DB_USERNAME=homestead
10 | DB_PASSWORD=secret
11 |
12 | CACHE_DRIVER=file
13 | SESSION_DRIVER=file
14 | QUEUE_DRIVER=sync
15 |
16 | REDIS_HOST=127.0.0.1
17 | REDIS_PASSWORD=null
18 | REDIS_PORT=6379
19 |
20 | MAIL_DRIVER=smtp
21 | MAIL_HOST=mailtrap.io
22 | MAIL_PORT=2525
23 | MAIL_USERNAME=null
24 | MAIL_PASSWORD=null
25 | MAIL_ENCRYPTION=null
26 |
--------------------------------------------------------------------------------
/apis/movies/.gitattributes:
--------------------------------------------------------------------------------
1 | * text=auto
2 | *.css linguist-vendored
3 | *.less linguist-vendored
4 |
--------------------------------------------------------------------------------
/apis/movies/.gitignore:
--------------------------------------------------------------------------------
1 | /vendor
2 | /node_modules
3 | /public/storage
4 | Homestead.yaml
5 | Homestead.json
6 | .env
7 |
--------------------------------------------------------------------------------
/apis/movies/app/Console/Commands/Inspire.php:
--------------------------------------------------------------------------------
1 | comment(PHP_EOL.Inspiring::quote().PHP_EOL);
32 | }
33 | }
34 |
--------------------------------------------------------------------------------
/apis/movies/app/Console/Kernel.php:
--------------------------------------------------------------------------------
1 | command('inspire')
28 | // ->hourly();
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/apis/movies/app/Events/Event.php:
--------------------------------------------------------------------------------
1 | middleware('guest');
31 | }
32 | }
33 |
--------------------------------------------------------------------------------
/apis/movies/app/Http/Controllers/Controller.php:
--------------------------------------------------------------------------------
1 | guest()) {
21 | if ($request->ajax() || $request->wantsJson()) {
22 | return response('Unauthorized.', 401);
23 | } else {
24 | return redirect()->guest('login');
25 | }
26 | }
27 |
28 | return $next($request);
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/apis/movies/app/Http/Middleware/EncryptCookies.php:
--------------------------------------------------------------------------------
1 | check()) {
21 | return redirect('/');
22 | }
23 |
24 | return $next($request);
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/apis/movies/app/Http/Middleware/VerifyCsrfToken.php:
--------------------------------------------------------------------------------
1 | 'api'], function () {
30 | Route::resource('movies', 'Api\MoviesController');
31 | });
32 |
--------------------------------------------------------------------------------
/apis/movies/app/Jobs/Job.php:
--------------------------------------------------------------------------------
1 | [
15 | 'code' => 'ERR-NOTFOUND',
16 | 'http_code' => '404',
17 | 'message' => 'Requested movie cannot be found in the database.',
18 | ]
19 | ];
20 | return \Response::json($error, 404);
21 | }
22 | return $story;
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/apis/movies/app/Policies/.gitkeep:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------
/apis/movies/app/Providers/AppServiceProvider.php:
--------------------------------------------------------------------------------
1 | 'App\Policies\ModelPolicy',
17 | ];
18 |
19 | /**
20 | * Register any application authentication / authorization services.
21 | *
22 | * @param \Illuminate\Contracts\Auth\Access\Gate $gate
23 | * @return void
24 | */
25 | public function boot(GateContract $gate)
26 | {
27 | $this->registerPolicies($gate);
28 |
29 | //
30 | }
31 | }
32 |
--------------------------------------------------------------------------------
/apis/movies/app/Providers/EventServiceProvider.php:
--------------------------------------------------------------------------------
1 | [
17 | 'App\Listeners\EventListener',
18 | ],
19 | ];
20 |
21 | /**
22 | * Register any other events for your application.
23 | *
24 | * @param \Illuminate\Contracts\Events\Dispatcher $events
25 | * @return void
26 | */
27 | public function boot(DispatcherContract $events)
28 | {
29 | parent::boot($events);
30 |
31 | //
32 | }
33 | }
34 |
--------------------------------------------------------------------------------
/apis/movies/app/Providers/RouteServiceProvider.php:
--------------------------------------------------------------------------------
1 | group(['namespace' => $this->namespace], function ($router) {
41 | require app_path('Http/routes.php');
42 | });
43 | }
44 | }
45 |
--------------------------------------------------------------------------------
/apis/movies/app/User.php:
--------------------------------------------------------------------------------
1 | =5.5.9",
9 | "laravel/framework": "5.2.*"
10 | },
11 | "require-dev": {
12 | "fzaninotto/faker": "~1.4",
13 | "mockery/mockery": "0.9.*",
14 | "phpunit/phpunit": "~4.0",
15 | "symfony/css-selector": "2.8.*|3.0.*",
16 | "symfony/dom-crawler": "2.8.*|3.0.*"
17 | },
18 | "autoload": {
19 | "classmap": [
20 | "database"
21 | ],
22 | "psr-4": {
23 | "App\\": "app/"
24 | }
25 | },
26 | "autoload-dev": {
27 | "classmap": [
28 | "tests/TestCase.php"
29 | ]
30 | },
31 | "scripts": {
32 | "post-root-package-install": [
33 | "php -r \"copy('.env.example', '.env');\""
34 | ],
35 | "post-create-project-cmd": [
36 | "php artisan key:generate"
37 | ],
38 | "post-install-cmd": [
39 | "php artisan clear-compiled",
40 | "php artisan optimize"
41 | ],
42 | "pre-update-cmd": [
43 | "php artisan clear-compiled"
44 | ],
45 | "post-update-cmd": [
46 | "php artisan optimize"
47 | ]
48 | },
49 | "config": {
50 | "preferred-install": "dist"
51 | }
52 | }
53 |
--------------------------------------------------------------------------------
/apis/movies/config/broadcasting.php:
--------------------------------------------------------------------------------
1 | env('BROADCAST_DRIVER', 'pusher'),
17 |
18 | /*
19 | |--------------------------------------------------------------------------
20 | | Broadcast Connections
21 | |--------------------------------------------------------------------------
22 | |
23 | | Here you may define all of the broadcast connections that will be used
24 | | to broadcast events to other systems or over websockets. Samples of
25 | | each available type of connection are provided inside this array.
26 | |
27 | */
28 |
29 | 'connections' => [
30 |
31 | 'pusher' => [
32 | 'driver' => 'pusher',
33 | 'key' => env('PUSHER_KEY'),
34 | 'secret' => env('PUSHER_SECRET'),
35 | 'app_id' => env('PUSHER_APP_ID'),
36 | 'options' => [
37 | //
38 | ],
39 | ],
40 |
41 | 'redis' => [
42 | 'driver' => 'redis',
43 | 'connection' => 'default',
44 | ],
45 |
46 | 'log' => [
47 | 'driver' => 'log',
48 | ],
49 |
50 | ],
51 |
52 | ];
53 |
--------------------------------------------------------------------------------
/apis/movies/config/compile.php:
--------------------------------------------------------------------------------
1 | [
17 | //
18 | ],
19 |
20 | /*
21 | |--------------------------------------------------------------------------
22 | | Compiled File Providers
23 | |--------------------------------------------------------------------------
24 | |
25 | | Here you may list service providers which define a "compiles" function
26 | | that returns additional files that should be compiled, providing an
27 | | easy way to get common files from any packages you are utilizing.
28 | |
29 | */
30 |
31 | 'providers' => [
32 | //
33 | ],
34 |
35 | ];
36 |
--------------------------------------------------------------------------------
/apis/movies/config/services.php:
--------------------------------------------------------------------------------
1 | [
18 | 'domain' => env('MAILGUN_DOMAIN'),
19 | 'secret' => env('MAILGUN_SECRET'),
20 | ],
21 |
22 | 'ses' => [
23 | 'key' => env('SES_KEY'),
24 | 'secret' => env('SES_SECRET'),
25 | 'region' => 'us-east-1',
26 | ],
27 |
28 | 'sparkpost' => [
29 | 'secret' => env('SPARKPOST_SECRET'),
30 | ],
31 |
32 | 'stripe' => [
33 | 'model' => App\User::class,
34 | 'key' => env('STRIPE_KEY'),
35 | 'secret' => env('STRIPE_SECRET'),
36 | ],
37 |
38 | ];
39 |
--------------------------------------------------------------------------------
/apis/movies/config/view.php:
--------------------------------------------------------------------------------
1 | [
17 | realpath(base_path('resources/views')),
18 | ],
19 |
20 | /*
21 | |--------------------------------------------------------------------------
22 | | Compiled View Path
23 | |--------------------------------------------------------------------------
24 | |
25 | | This option determines where all the compiled Blade templates will be
26 | | stored for your application. Typically, this is within the storage
27 | | directory. However, as usual, you are free to change this value.
28 | |
29 | */
30 |
31 | 'compiled' => realpath(storage_path('framework/views')),
32 |
33 | ];
34 |
--------------------------------------------------------------------------------
/apis/movies/database.sqlite:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hootlex/the-majesty-of-vuejs/30bd16d6ccd51c26f2e120ac099469844a14bdb4/apis/movies/database.sqlite
--------------------------------------------------------------------------------
/apis/movies/database/.gitignore:
--------------------------------------------------------------------------------
1 | *.sqlite
2 |
--------------------------------------------------------------------------------
/apis/movies/database/migrations/.gitkeep:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------
/apis/movies/database/migrations/2014_10_12_000000_create_users_table.php:
--------------------------------------------------------------------------------
1 | increments('id');
17 | $table->string('name');
18 | $table->string('email')->unique();
19 | $table->string('password');
20 | $table->rememberToken();
21 | $table->timestamps();
22 | });
23 | }
24 |
25 | /**
26 | * Reverse the migrations.
27 | *
28 | * @return void
29 | */
30 | public function down()
31 | {
32 | Schema::drop('users');
33 | }
34 | }
35 |
--------------------------------------------------------------------------------
/apis/movies/database/migrations/2014_10_12_100000_create_password_resets_table.php:
--------------------------------------------------------------------------------
1 | string('email')->index();
17 | $table->string('token')->index();
18 | $table->timestamp('created_at');
19 | });
20 | }
21 |
22 | /**
23 | * Reverse the migrations.
24 | *
25 | * @return void
26 | */
27 | public function down()
28 | {
29 | Schema::drop('password_resets');
30 | }
31 | }
32 |
--------------------------------------------------------------------------------
/apis/movies/database/migrations/2016_03_10_045354_create_movies_table.php:
--------------------------------------------------------------------------------
1 | increments('id');
17 | $table->string('title');
18 | $table->string('director');
19 | $table->timestamps();
20 | });
21 | }
22 |
23 | /**
24 | * Reverse the migrations.
25 | *
26 | * @return void
27 | */
28 | public function down()
29 | {
30 | Schema::table('movies', function (Blueprint $table) {
31 | Schema::drop('movies');
32 | });
33 | }
34 | }
35 |
--------------------------------------------------------------------------------
/apis/movies/database/seeds/.gitkeep:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------
/apis/movies/database/seeds/DatabaseSeeder.php:
--------------------------------------------------------------------------------
1 | call(MovieSeeder::class);
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/apis/movies/database/seeds/MovieSeeder.php:
--------------------------------------------------------------------------------
1 | truncate();
15 | factory(App\Movie::class, 20)->create();
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/apis/movies/gulpfile.js:
--------------------------------------------------------------------------------
1 | var elixir = require('laravel-elixir');
2 |
3 | /*
4 | |--------------------------------------------------------------------------
5 | | Elixir Asset Management
6 | |--------------------------------------------------------------------------
7 | |
8 | | Elixir provides a clean, fluent API for defining some basic Gulp tasks
9 | | for your Laravel application. By default, we are compiling the Sass
10 | | file for our application, as well as publishing vendor resources.
11 | |
12 | */
13 |
14 | elixir(function(mix) {
15 | mix.sass('app.scss');
16 | });
17 |
--------------------------------------------------------------------------------
/apis/movies/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "private": true,
3 | "devDependencies": {
4 | "gulp": "^3.8.8"
5 | },
6 | "dependencies": {
7 | "laravel-elixir": "^4.0.0",
8 | "bootstrap-sass": "^3.0.0"
9 | }
10 | }
11 |
--------------------------------------------------------------------------------
/apis/movies/phpunit.xml:
--------------------------------------------------------------------------------
1 |
2 |
11 |
12 |
13 | ./tests/
14 |
15 |
16 |
17 |
18 | app/
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
--------------------------------------------------------------------------------
/apis/movies/public/.htaccess:
--------------------------------------------------------------------------------
1 |
2 |
3 | Options -MultiViews
4 |
5 |
6 | RewriteEngine On
7 |
8 | # Redirect Trailing Slashes If Not A Folder...
9 | RewriteCond %{REQUEST_FILENAME} !-d
10 | RewriteRule ^(.*)/$ /$1 [L,R=301]
11 |
12 | # Handle Front Controller...
13 | RewriteCond %{REQUEST_FILENAME} !-d
14 | RewriteCond %{REQUEST_FILENAME} !-f
15 | RewriteRule ^ index.php [L]
16 |
17 | # Handle Authorization Header
18 | RewriteCond %{HTTP:Authorization} .
19 | RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
20 |
21 |
--------------------------------------------------------------------------------
/apis/movies/public/favicon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hootlex/the-majesty-of-vuejs/30bd16d6ccd51c26f2e120ac099469844a14bdb4/apis/movies/public/favicon.ico
--------------------------------------------------------------------------------
/apis/movies/public/js/app.js:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hootlex/the-majesty-of-vuejs/30bd16d6ccd51c26f2e120ac099469844a14bdb4/apis/movies/public/js/app.js
--------------------------------------------------------------------------------
/apis/movies/public/movies.html:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hootlex/the-majesty-of-vuejs/30bd16d6ccd51c26f2e120ac099469844a14bdb4/apis/movies/public/movies.html
--------------------------------------------------------------------------------
/apis/movies/public/robots.txt:
--------------------------------------------------------------------------------
1 | User-agent: *
2 | Disallow:
3 |
--------------------------------------------------------------------------------
/apis/movies/public/web.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
--------------------------------------------------------------------------------
/apis/movies/readme.md:
--------------------------------------------------------------------------------
1 | This is the API used in the "Consuming an API" part of the book, in its homework section and it is intended for educational use.
2 |
3 | By running the following command you will get a database filled with dummy data and a fully functional API.
4 |
5 | ```bash
6 | sh setup.sh
7 | ```
8 |
9 | Then you will be able to access the site on `http://localhost:3000`.
10 |
11 | This API is built with [Laravel](http://laravel.com)
12 |
--------------------------------------------------------------------------------
/apis/movies/resources/assets/sass/app.scss:
--------------------------------------------------------------------------------
1 | // @import "node_modules/bootstrap-sass/assets/stylesheets/bootstrap";
2 |
3 |
--------------------------------------------------------------------------------
/apis/movies/resources/lang/en/auth.php:
--------------------------------------------------------------------------------
1 | 'These credentials do not match our records.',
17 | 'throttle' => 'Too many login attempts. Please try again in :seconds seconds.',
18 |
19 | ];
20 |
--------------------------------------------------------------------------------
/apis/movies/resources/lang/en/pagination.php:
--------------------------------------------------------------------------------
1 | '« Previous',
17 | 'next' => 'Next »',
18 |
19 | ];
20 |
--------------------------------------------------------------------------------
/apis/movies/resources/lang/en/passwords.php:
--------------------------------------------------------------------------------
1 | 'Passwords must be at least six characters and match the confirmation.',
17 | 'reset' => 'Your password has been reset!',
18 | 'sent' => 'We have e-mailed your password reset link!',
19 | 'token' => 'This password reset token is invalid.',
20 | 'user' => "We can't find a user with that e-mail address.",
21 |
22 | ];
23 |
--------------------------------------------------------------------------------
/apis/movies/resources/views/errors/503.blade.php:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Be right back.
5 |
6 |
7 |
8 |
39 |
40 |
41 |
46 |
47 |
48 |
--------------------------------------------------------------------------------
/apis/movies/resources/views/vendor/.gitkeep:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------
/apis/movies/resources/views/welcome.blade.php:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Laravel
5 |
6 |
7 |
8 |
37 |
38 |
39 |
44 |
45 |
46 |
--------------------------------------------------------------------------------
/apis/movies/server.php:
--------------------------------------------------------------------------------
1 |
8 | */
9 |
10 | $uri = urldecode(
11 | parse_url($_SERVER['REQUEST_URI'], PHP_URL_PATH)
12 | );
13 |
14 | // This file allows us to emulate Apache's "mod_rewrite" functionality from the
15 | // built-in PHP web server. This provides a convenient way to test a Laravel
16 | // application without having installed a "real" web server software here.
17 | if ($uri !== '/' && file_exists(__DIR__.'/public'.$uri)) {
18 | return false;
19 | }
20 |
21 | require_once __DIR__.'/public/index.php';
22 |
--------------------------------------------------------------------------------
/apis/movies/setup.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash;
2 | echo "Begin Setup";
3 |
4 | echo "Install project dependencies...";
5 | composer install || {
6 | echo "Composer not found. Installing Composer...";
7 | php -r "readfile('https://getcomposer.org/installer');" | php;
8 | #mv composer.phar /usr/local/bin/composer -n;
9 | php composer.phar install;
10 | }
11 | echo "Create database";
12 | touch database/database.sqlite;
13 |
14 | echo "Migrate & Seed";
15 | php artisan migrate;
16 | php artisan db:seed;
17 | php artisan serve --port=3000 --host localhost;
--------------------------------------------------------------------------------
/apis/movies/storage/app/.gitignore:
--------------------------------------------------------------------------------
1 | *
2 | !public/
3 | !.gitignore
4 |
--------------------------------------------------------------------------------
/apis/movies/storage/app/public/.gitignore:
--------------------------------------------------------------------------------
1 | *
2 | !.gitignore
3 |
--------------------------------------------------------------------------------
/apis/movies/storage/framework/.gitignore:
--------------------------------------------------------------------------------
1 | config.php
2 | routes.php
3 | compiled.php
4 | services.json
5 | events.scanned.php
6 | routes.scanned.php
7 | down
8 |
--------------------------------------------------------------------------------
/apis/movies/storage/framework/cache/.gitignore:
--------------------------------------------------------------------------------
1 | *
2 | !.gitignore
3 |
--------------------------------------------------------------------------------
/apis/movies/storage/framework/sessions/.gitignore:
--------------------------------------------------------------------------------
1 | *
2 | !.gitignore
3 |
--------------------------------------------------------------------------------
/apis/movies/storage/framework/views/.gitignore:
--------------------------------------------------------------------------------
1 | *
2 | !.gitignore
3 |
--------------------------------------------------------------------------------
/apis/movies/storage/logs/.gitignore:
--------------------------------------------------------------------------------
1 | *
2 | !.gitignore
3 |
--------------------------------------------------------------------------------
/apis/movies/tests/ExampleTest.php:
--------------------------------------------------------------------------------
1 | visit('/')
17 | ->see('Laravel 5');
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/apis/movies/tests/TestCase.php:
--------------------------------------------------------------------------------
1 | make(Illuminate\Contracts\Console\Kernel::class)->bootstrap();
22 |
23 | return $app;
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/apis/pagination/stories/.env.example:
--------------------------------------------------------------------------------
1 | APP_ENV=local
2 | APP_DEBUG=true
3 | APP_KEY=SomeRandomString
4 | APP_URL=http://localhost
5 |
6 | DB_HOST=127.0.0.1
7 | DB_PORT=3306
8 | DB_DATABASE=homestead
9 | DB_USERNAME=homestead
10 | DB_PASSWORD=secret
11 |
12 | CACHE_DRIVER=file
13 | SESSION_DRIVER=file
14 | QUEUE_DRIVER=sync
15 |
16 | REDIS_HOST=127.0.0.1
17 | REDIS_PASSWORD=null
18 | REDIS_PORT=6379
19 |
20 | MAIL_DRIVER=smtp
21 | MAIL_HOST=mailtrap.io
22 | MAIL_PORT=2525
23 | MAIL_USERNAME=null
24 | MAIL_PASSWORD=null
25 | MAIL_ENCRYPTION=null
26 |
--------------------------------------------------------------------------------
/apis/pagination/stories/.gitattributes:
--------------------------------------------------------------------------------
1 | * text=auto
2 | *.css linguist-vendored
3 | *.less linguist-vendored
4 |
--------------------------------------------------------------------------------
/apis/pagination/stories/.gitignore:
--------------------------------------------------------------------------------
1 | /vendor
2 | /node_modules
3 | /public/storage
4 | Homestead.yaml
5 | Homestead.json
6 | .env
7 |
--------------------------------------------------------------------------------
/apis/pagination/stories/app/Console/Commands/Inspire.php:
--------------------------------------------------------------------------------
1 | comment(PHP_EOL.Inspiring::quote().PHP_EOL);
32 | }
33 | }
34 |
--------------------------------------------------------------------------------
/apis/pagination/stories/app/Console/Kernel.php:
--------------------------------------------------------------------------------
1 | command('inspire')
28 | // ->hourly();
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/apis/pagination/stories/app/Events/Event.php:
--------------------------------------------------------------------------------
1 | middleware('guest');
31 | }
32 | }
33 |
--------------------------------------------------------------------------------
/apis/pagination/stories/app/Http/Controllers/Controller.php:
--------------------------------------------------------------------------------
1 | guest()) {
21 | if ($request->ajax() || $request->wantsJson()) {
22 | return response('Unauthorized.', 401);
23 | } else {
24 | return redirect()->guest('login');
25 | }
26 | }
27 |
28 | return $next($request);
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/apis/pagination/stories/app/Http/Middleware/EncryptCookies.php:
--------------------------------------------------------------------------------
1 | check()) {
21 | return redirect('/');
22 | }
23 |
24 | return $next($request);
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/apis/pagination/stories/app/Http/Middleware/VerifyCsrfToken.php:
--------------------------------------------------------------------------------
1 | 'api'], function () {
30 | Route::resource('stories', 'Api\StoriesController');
31 | });
32 |
--------------------------------------------------------------------------------
/apis/pagination/stories/app/Jobs/Job.php:
--------------------------------------------------------------------------------
1 | 'App\Policies\ModelPolicy',
17 | ];
18 |
19 | /**
20 | * Register any application authentication / authorization services.
21 | *
22 | * @param \Illuminate\Contracts\Auth\Access\Gate $gate
23 | * @return void
24 | */
25 | public function boot(GateContract $gate)
26 | {
27 | $this->registerPolicies($gate);
28 |
29 | //
30 | }
31 | }
32 |
--------------------------------------------------------------------------------
/apis/pagination/stories/app/Providers/EventServiceProvider.php:
--------------------------------------------------------------------------------
1 | [
17 | 'App\Listeners\EventListener',
18 | ],
19 | ];
20 |
21 | /**
22 | * Register any other events for your application.
23 | *
24 | * @param \Illuminate\Contracts\Events\Dispatcher $events
25 | * @return void
26 | */
27 | public function boot(DispatcherContract $events)
28 | {
29 | parent::boot($events);
30 |
31 | //
32 | }
33 | }
34 |
--------------------------------------------------------------------------------
/apis/pagination/stories/app/Providers/RouteServiceProvider.php:
--------------------------------------------------------------------------------
1 | group(['namespace' => $this->namespace], function ($router) {
41 | require app_path('Http/routes.php');
42 | });
43 | }
44 | }
45 |
--------------------------------------------------------------------------------
/apis/pagination/stories/app/Story.php:
--------------------------------------------------------------------------------
1 | [
15 | 'code' => 'ERR-NOTFOUND',
16 | 'http_code' => '404',
17 | 'message' => 'Requested story cannot be found in the database.',
18 | ]
19 | ];
20 | return \Response::json($error, 404);
21 | }
22 | return $story;
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/apis/pagination/stories/app/User.php:
--------------------------------------------------------------------------------
1 | =5.5.9",
9 | "laravel/framework": "5.2.*"
10 | },
11 | "require-dev": {
12 | "fzaninotto/faker": "~1.4",
13 | "mockery/mockery": "0.9.*",
14 | "phpunit/phpunit": "~4.0",
15 | "symfony/css-selector": "2.8.*|3.0.*",
16 | "symfony/dom-crawler": "2.8.*|3.0.*"
17 | },
18 | "autoload": {
19 | "classmap": [
20 | "database"
21 | ],
22 | "psr-4": {
23 | "App\\": "app/"
24 | }
25 | },
26 | "autoload-dev": {
27 | "classmap": [
28 | "tests/TestCase.php"
29 | ]
30 | },
31 | "scripts": {
32 | "post-root-package-install": [
33 | "php -r \"copy('.env.example', '.env');\""
34 | ],
35 | "post-create-project-cmd": [
36 | "php artisan key:generate"
37 | ],
38 | "post-install-cmd": [
39 | "php artisan clear-compiled",
40 | "php artisan optimize"
41 | ],
42 | "pre-update-cmd": [
43 | "php artisan clear-compiled"
44 | ],
45 | "post-update-cmd": [
46 | "php artisan optimize"
47 | ]
48 | },
49 | "config": {
50 | "preferred-install": "dist"
51 | }
52 | }
53 |
--------------------------------------------------------------------------------
/apis/pagination/stories/config/compile.php:
--------------------------------------------------------------------------------
1 | [
17 | //
18 | ],
19 |
20 | /*
21 | |--------------------------------------------------------------------------
22 | | Compiled File Providers
23 | |--------------------------------------------------------------------------
24 | |
25 | | Here you may list service providers which define a "compiles" function
26 | | that returns additional files that should be compiled, providing an
27 | | easy way to get common files from any packages you are utilizing.
28 | |
29 | */
30 |
31 | 'providers' => [
32 | //
33 | ],
34 |
35 | ];
36 |
--------------------------------------------------------------------------------
/apis/pagination/stories/config/services.php:
--------------------------------------------------------------------------------
1 | [
18 | 'domain' => env('MAILGUN_DOMAIN'),
19 | 'secret' => env('MAILGUN_SECRET'),
20 | ],
21 |
22 | 'ses' => [
23 | 'key' => env('SES_KEY'),
24 | 'secret' => env('SES_SECRET'),
25 | 'region' => 'us-east-1',
26 | ],
27 |
28 | 'sparkpost' => [
29 | 'secret' => env('SPARKPOST_SECRET'),
30 | ],
31 |
32 | 'stripe' => [
33 | 'model' => App\User::class,
34 | 'key' => env('STRIPE_KEY'),
35 | 'secret' => env('STRIPE_SECRET'),
36 | ],
37 |
38 | ];
39 |
--------------------------------------------------------------------------------
/apis/pagination/stories/config/view.php:
--------------------------------------------------------------------------------
1 | [
17 | realpath(base_path('resources/views')),
18 | ],
19 |
20 | /*
21 | |--------------------------------------------------------------------------
22 | | Compiled View Path
23 | |--------------------------------------------------------------------------
24 | |
25 | | This option determines where all the compiled Blade templates will be
26 | | stored for your application. Typically, this is within the storage
27 | | directory. However, as usual, you are free to change this value.
28 | |
29 | */
30 |
31 | 'compiled' => realpath(storage_path('framework/views')),
32 |
33 | ];
34 |
--------------------------------------------------------------------------------
/apis/pagination/stories/database.sqlite:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hootlex/the-majesty-of-vuejs/30bd16d6ccd51c26f2e120ac099469844a14bdb4/apis/pagination/stories/database.sqlite
--------------------------------------------------------------------------------
/apis/pagination/stories/database/.gitignore:
--------------------------------------------------------------------------------
1 | *.sqlite
2 |
--------------------------------------------------------------------------------
/apis/pagination/stories/database/migrations/.gitkeep:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------
/apis/pagination/stories/database/migrations/2014_10_12_000000_create_users_table.php:
--------------------------------------------------------------------------------
1 | increments('id');
17 | $table->string('name');
18 | $table->string('email')->unique();
19 | $table->string('password');
20 | $table->rememberToken();
21 | $table->timestamps();
22 | });
23 | }
24 |
25 | /**
26 | * Reverse the migrations.
27 | *
28 | * @return void
29 | */
30 | public function down()
31 | {
32 | Schema::drop('users');
33 | }
34 | }
35 |
--------------------------------------------------------------------------------
/apis/pagination/stories/database/migrations/2014_10_12_100000_create_password_resets_table.php:
--------------------------------------------------------------------------------
1 | string('email')->index();
17 | $table->string('token')->index();
18 | $table->timestamp('created_at');
19 | });
20 | }
21 |
22 | /**
23 | * Reverse the migrations.
24 | *
25 | * @return void
26 | */
27 | public function down()
28 | {
29 | Schema::drop('password_resets');
30 | }
31 | }
32 |
--------------------------------------------------------------------------------
/apis/pagination/stories/database/migrations/2016_03_10_045354_create_stories_table.php:
--------------------------------------------------------------------------------
1 | increments('id');
17 | $table->string('plot');
18 | $table->integer('upvotes')->unsigned();
19 | $table->string('writer');
20 | $table->timestamps();
21 | });
22 | }
23 |
24 | /**
25 | * Reverse the migrations.
26 | *
27 | * @return void
28 | */
29 | public function down()
30 | {
31 | Schema::table('stories', function (Blueprint $table) {
32 | Schema::drop('stories');
33 | });
34 | }
35 | }
36 |
--------------------------------------------------------------------------------
/apis/pagination/stories/database/seeds/.gitkeep:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------
/apis/pagination/stories/database/seeds/DatabaseSeeder.php:
--------------------------------------------------------------------------------
1 | call(StorySeeder::class);
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/apis/pagination/stories/database/seeds/StorySeeder.php:
--------------------------------------------------------------------------------
1 | truncate();
15 | factory(App\Story::class, 200)->create();
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/apis/pagination/stories/gulpfile.js:
--------------------------------------------------------------------------------
1 | var elixir = require('laravel-elixir');
2 |
3 | /*
4 | |--------------------------------------------------------------------------
5 | | Elixir Asset Management
6 | |--------------------------------------------------------------------------
7 | |
8 | | Elixir provides a clean, fluent API for defining some basic Gulp tasks
9 | | for your Laravel application. By default, we are compiling the Sass
10 | | file for our application, as well as publishing vendor resources.
11 | |
12 | */
13 |
14 | elixir(function(mix) {
15 | mix.sass('app.scss');
16 | });
17 |
--------------------------------------------------------------------------------
/apis/pagination/stories/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "private": true,
3 | "devDependencies": {
4 | "gulp": "^3.8.8"
5 | },
6 | "dependencies": {
7 | "laravel-elixir": "^4.0.0",
8 | "bootstrap-sass": "^3.0.0"
9 | }
10 | }
11 |
--------------------------------------------------------------------------------
/apis/pagination/stories/phpunit.xml:
--------------------------------------------------------------------------------
1 |
2 |
11 |
12 |
13 | ./tests/
14 |
15 |
16 |
17 |
18 | app/
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
--------------------------------------------------------------------------------
/apis/pagination/stories/public/.htaccess:
--------------------------------------------------------------------------------
1 |
2 |
3 | Options -MultiViews
4 |
5 |
6 | RewriteEngine On
7 |
8 | # Redirect Trailing Slashes If Not A Folder...
9 | RewriteCond %{REQUEST_FILENAME} !-d
10 | RewriteRule ^(.*)/$ /$1 [L,R=301]
11 |
12 | # Handle Front Controller...
13 | RewriteCond %{REQUEST_FILENAME} !-d
14 | RewriteCond %{REQUEST_FILENAME} !-f
15 | RewriteRule ^ index.php [L]
16 |
17 | # Handle Authorization Header
18 | RewriteCond %{HTTP:Authorization} .
19 | RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
20 |
21 |
--------------------------------------------------------------------------------
/apis/pagination/stories/public/favicon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hootlex/the-majesty-of-vuejs/30bd16d6ccd51c26f2e120ac099469844a14bdb4/apis/pagination/stories/public/favicon.ico
--------------------------------------------------------------------------------
/apis/pagination/stories/public/robots.txt:
--------------------------------------------------------------------------------
1 | User-agent: *
2 | Disallow:
3 |
--------------------------------------------------------------------------------
/apis/pagination/stories/public/web.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
--------------------------------------------------------------------------------
/apis/pagination/stories/resources/assets/sass/app.scss:
--------------------------------------------------------------------------------
1 | // @import "node_modules/bootstrap-sass/assets/stylesheets/bootstrap";
2 |
3 |
--------------------------------------------------------------------------------
/apis/pagination/stories/resources/lang/en/auth.php:
--------------------------------------------------------------------------------
1 | 'These credentials do not match our records.',
17 | 'throttle' => 'Too many login attempts. Please try again in :seconds seconds.',
18 |
19 | ];
20 |
--------------------------------------------------------------------------------
/apis/pagination/stories/resources/lang/en/pagination.php:
--------------------------------------------------------------------------------
1 | '« Previous',
17 | 'next' => 'Next »',
18 |
19 | ];
20 |
--------------------------------------------------------------------------------
/apis/pagination/stories/resources/lang/en/passwords.php:
--------------------------------------------------------------------------------
1 | 'Passwords must be at least six characters and match the confirmation.',
17 | 'reset' => 'Your password has been reset!',
18 | 'sent' => 'We have e-mailed your password reset link!',
19 | 'token' => 'This password reset token is invalid.',
20 | 'user' => "We can't find a user with that e-mail address.",
21 |
22 | ];
23 |
--------------------------------------------------------------------------------
/apis/pagination/stories/resources/views/errors/503.blade.php:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Be right back.
5 |
6 |
7 |
8 |
39 |
40 |
41 |
46 |
47 |
48 |
--------------------------------------------------------------------------------
/apis/pagination/stories/resources/views/vendor/.gitkeep:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------
/apis/pagination/stories/resources/views/welcome.blade.php:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Laravel
5 |
6 |
7 |
8 |
37 |
38 |
39 |
44 |
45 |
46 |
--------------------------------------------------------------------------------
/apis/pagination/stories/server.php:
--------------------------------------------------------------------------------
1 |
8 | */
9 |
10 | $uri = urldecode(
11 | parse_url($_SERVER['REQUEST_URI'], PHP_URL_PATH)
12 | );
13 |
14 | // This file allows us to emulate Apache's "mod_rewrite" functionality from the
15 | // built-in PHP web server. This provides a convenient way to test a Laravel
16 | // application without having installed a "real" web server software here.
17 | if ($uri !== '/' && file_exists(__DIR__.'/public'.$uri)) {
18 | return false;
19 | }
20 |
21 | require_once __DIR__.'/public/index.php';
22 |
--------------------------------------------------------------------------------
/apis/pagination/stories/setup.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash;
2 | echo "Begin Setup";
3 |
4 | echo "Install project dependencies...";
5 | composer install || {
6 | echo "Composer not found. Installing Composer...";
7 | php -r "readfile('https://getcomposer.org/installer');" | php;
8 | #mv composer.phar /usr/local/bin/composer -n;
9 | php composer.phar install;
10 | }
11 | echo "Create database";
12 | touch database/database.sqlite;
13 |
14 | echo "Migrate & Seed";
15 | php artisan migrate;
16 | php artisan db:seed;
17 | php artisan serve --port=3000 --host localhost;
--------------------------------------------------------------------------------
/apis/pagination/stories/storage/app/.gitignore:
--------------------------------------------------------------------------------
1 | *
2 | !public/
3 | !.gitignore
4 |
--------------------------------------------------------------------------------
/apis/pagination/stories/storage/app/public/.gitignore:
--------------------------------------------------------------------------------
1 | *
2 | !.gitignore
3 |
--------------------------------------------------------------------------------
/apis/pagination/stories/storage/framework/.gitignore:
--------------------------------------------------------------------------------
1 | config.php
2 | routes.php
3 | compiled.php
4 | services.json
5 | events.scanned.php
6 | routes.scanned.php
7 | down
8 |
--------------------------------------------------------------------------------
/apis/pagination/stories/storage/framework/cache/.gitignore:
--------------------------------------------------------------------------------
1 | *
2 | !.gitignore
3 |
--------------------------------------------------------------------------------
/apis/pagination/stories/storage/framework/sessions/.gitignore:
--------------------------------------------------------------------------------
1 | *
2 | !.gitignore
3 |
--------------------------------------------------------------------------------
/apis/pagination/stories/storage/framework/views/.gitignore:
--------------------------------------------------------------------------------
1 | *
2 | !.gitignore
3 |
--------------------------------------------------------------------------------
/apis/pagination/stories/storage/logs/.gitignore:
--------------------------------------------------------------------------------
1 | *
2 | !.gitignore
3 |
--------------------------------------------------------------------------------
/apis/pagination/stories/tests/ExampleTest.php:
--------------------------------------------------------------------------------
1 | visit('/')
17 | ->see('Laravel 5');
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/apis/pagination/stories/tests/TestCase.php:
--------------------------------------------------------------------------------
1 | make(Illuminate\Contracts\Console\Kernel::class)->bootstrap();
22 |
23 | return $app;
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/apis/stories/.env.example:
--------------------------------------------------------------------------------
1 | APP_ENV=local
2 | APP_DEBUG=true
3 | APP_KEY=SomeRandomString
4 | APP_URL=http://localhost
5 |
6 | DB_HOST=127.0.0.1
7 | DB_PORT=3306
8 | DB_DATABASE=homestead
9 | DB_USERNAME=homestead
10 | DB_PASSWORD=secret
11 |
12 | CACHE_DRIVER=file
13 | SESSION_DRIVER=file
14 | QUEUE_DRIVER=sync
15 |
16 | REDIS_HOST=127.0.0.1
17 | REDIS_PASSWORD=null
18 | REDIS_PORT=6379
19 |
20 | MAIL_DRIVER=smtp
21 | MAIL_HOST=mailtrap.io
22 | MAIL_PORT=2525
23 | MAIL_USERNAME=null
24 | MAIL_PASSWORD=null
25 | MAIL_ENCRYPTION=null
26 |
--------------------------------------------------------------------------------
/apis/stories/.gitattributes:
--------------------------------------------------------------------------------
1 | * text=auto
2 | *.css linguist-vendored
3 | *.less linguist-vendored
4 |
--------------------------------------------------------------------------------
/apis/stories/.gitignore:
--------------------------------------------------------------------------------
1 | /vendor
2 | /node_modules
3 | /public/storage
4 | Homestead.yaml
5 | Homestead.json
6 | .env
7 |
--------------------------------------------------------------------------------
/apis/stories/app/Console/Commands/Inspire.php:
--------------------------------------------------------------------------------
1 | comment(PHP_EOL.Inspiring::quote().PHP_EOL);
32 | }
33 | }
34 |
--------------------------------------------------------------------------------
/apis/stories/app/Console/Kernel.php:
--------------------------------------------------------------------------------
1 | command('inspire')
28 | // ->hourly();
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/apis/stories/app/Events/Event.php:
--------------------------------------------------------------------------------
1 | middleware('guest');
31 | }
32 | }
33 |
--------------------------------------------------------------------------------
/apis/stories/app/Http/Controllers/Controller.php:
--------------------------------------------------------------------------------
1 | guest()) {
21 | if ($request->ajax() || $request->wantsJson()) {
22 | return response('Unauthorized.', 401);
23 | } else {
24 | return redirect()->guest('login');
25 | }
26 | }
27 |
28 | return $next($request);
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/apis/stories/app/Http/Middleware/EncryptCookies.php:
--------------------------------------------------------------------------------
1 | check()) {
21 | return redirect('/');
22 | }
23 |
24 | return $next($request);
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/apis/stories/app/Http/Middleware/VerifyCsrfToken.php:
--------------------------------------------------------------------------------
1 | 'api'], function () {
30 | Route::resource('stories', 'Api\StoriesController');
31 | });
32 |
--------------------------------------------------------------------------------
/apis/stories/app/Jobs/Job.php:
--------------------------------------------------------------------------------
1 | 'App\Policies\ModelPolicy',
17 | ];
18 |
19 | /**
20 | * Register any application authentication / authorization services.
21 | *
22 | * @param \Illuminate\Contracts\Auth\Access\Gate $gate
23 | * @return void
24 | */
25 | public function boot(GateContract $gate)
26 | {
27 | $this->registerPolicies($gate);
28 |
29 | //
30 | }
31 | }
32 |
--------------------------------------------------------------------------------
/apis/stories/app/Providers/EventServiceProvider.php:
--------------------------------------------------------------------------------
1 | [
17 | 'App\Listeners\EventListener',
18 | ],
19 | ];
20 |
21 | /**
22 | * Register any other events for your application.
23 | *
24 | * @param \Illuminate\Contracts\Events\Dispatcher $events
25 | * @return void
26 | */
27 | public function boot(DispatcherContract $events)
28 | {
29 | parent::boot($events);
30 |
31 | //
32 | }
33 | }
34 |
--------------------------------------------------------------------------------
/apis/stories/app/Providers/RouteServiceProvider.php:
--------------------------------------------------------------------------------
1 | group(['namespace' => $this->namespace], function ($router) {
41 | require app_path('Http/routes.php');
42 | });
43 | }
44 | }
45 |
--------------------------------------------------------------------------------
/apis/stories/app/Story.php:
--------------------------------------------------------------------------------
1 | [
15 | 'code' => 'ERR-NOTFOUND',
16 | 'http_code' => '404',
17 | 'message' => 'Requested story cannot be found in the database.',
18 | ]
19 | ];
20 | return \Response::json($error, 404);
21 | }
22 | return $story;
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/apis/stories/app/User.php:
--------------------------------------------------------------------------------
1 | =5.5.9",
9 | "laravel/framework": "5.2.*"
10 | },
11 | "require-dev": {
12 | "fzaninotto/faker": "~1.4",
13 | "mockery/mockery": "0.9.*",
14 | "phpunit/phpunit": "~4.0",
15 | "symfony/css-selector": "2.8.*|3.0.*",
16 | "symfony/dom-crawler": "2.8.*|3.0.*"
17 | },
18 | "autoload": {
19 | "classmap": [
20 | "database"
21 | ],
22 | "psr-4": {
23 | "App\\": "app/"
24 | }
25 | },
26 | "autoload-dev": {
27 | "classmap": [
28 | "tests/TestCase.php"
29 | ]
30 | },
31 | "scripts": {
32 | "post-root-package-install": [
33 | "php -r \"copy('.env.example', '.env');\""
34 | ],
35 | "post-create-project-cmd": [
36 | "php artisan key:generate"
37 | ],
38 | "post-install-cmd": [
39 | "php artisan clear-compiled",
40 | "php artisan optimize"
41 | ],
42 | "pre-update-cmd": [
43 | "php artisan clear-compiled"
44 | ],
45 | "post-update-cmd": [
46 | "php artisan optimize"
47 | ]
48 | },
49 | "config": {
50 | "preferred-install": "dist"
51 | }
52 | }
53 |
--------------------------------------------------------------------------------
/apis/stories/config/compile.php:
--------------------------------------------------------------------------------
1 | [
17 | //
18 | ],
19 |
20 | /*
21 | |--------------------------------------------------------------------------
22 | | Compiled File Providers
23 | |--------------------------------------------------------------------------
24 | |
25 | | Here you may list service providers which define a "compiles" function
26 | | that returns additional files that should be compiled, providing an
27 | | easy way to get common files from any packages you are utilizing.
28 | |
29 | */
30 |
31 | 'providers' => [
32 | //
33 | ],
34 |
35 | ];
36 |
--------------------------------------------------------------------------------
/apis/stories/config/services.php:
--------------------------------------------------------------------------------
1 | [
18 | 'domain' => env('MAILGUN_DOMAIN'),
19 | 'secret' => env('MAILGUN_SECRET'),
20 | ],
21 |
22 | 'ses' => [
23 | 'key' => env('SES_KEY'),
24 | 'secret' => env('SES_SECRET'),
25 | 'region' => 'us-east-1',
26 | ],
27 |
28 | 'sparkpost' => [
29 | 'secret' => env('SPARKPOST_SECRET'),
30 | ],
31 |
32 | 'stripe' => [
33 | 'model' => App\User::class,
34 | 'key' => env('STRIPE_KEY'),
35 | 'secret' => env('STRIPE_SECRET'),
36 | ],
37 |
38 | ];
39 |
--------------------------------------------------------------------------------
/apis/stories/config/view.php:
--------------------------------------------------------------------------------
1 | [
17 | realpath(base_path('resources/views')),
18 | ],
19 |
20 | /*
21 | |--------------------------------------------------------------------------
22 | | Compiled View Path
23 | |--------------------------------------------------------------------------
24 | |
25 | | This option determines where all the compiled Blade templates will be
26 | | stored for your application. Typically, this is within the storage
27 | | directory. However, as usual, you are free to change this value.
28 | |
29 | */
30 |
31 | 'compiled' => realpath(storage_path('framework/views')),
32 |
33 | ];
34 |
--------------------------------------------------------------------------------
/apis/stories/database.sqlite:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hootlex/the-majesty-of-vuejs/30bd16d6ccd51c26f2e120ac099469844a14bdb4/apis/stories/database.sqlite
--------------------------------------------------------------------------------
/apis/stories/database/.gitignore:
--------------------------------------------------------------------------------
1 | *.sqlite
2 |
--------------------------------------------------------------------------------
/apis/stories/database/migrations/.gitkeep:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------
/apis/stories/database/migrations/2014_10_12_000000_create_users_table.php:
--------------------------------------------------------------------------------
1 | increments('id');
17 | $table->string('name');
18 | $table->string('email')->unique();
19 | $table->string('password');
20 | $table->rememberToken();
21 | $table->timestamps();
22 | });
23 | }
24 |
25 | /**
26 | * Reverse the migrations.
27 | *
28 | * @return void
29 | */
30 | public function down()
31 | {
32 | Schema::drop('users');
33 | }
34 | }
35 |
--------------------------------------------------------------------------------
/apis/stories/database/migrations/2014_10_12_100000_create_password_resets_table.php:
--------------------------------------------------------------------------------
1 | string('email')->index();
17 | $table->string('token')->index();
18 | $table->timestamp('created_at');
19 | });
20 | }
21 |
22 | /**
23 | * Reverse the migrations.
24 | *
25 | * @return void
26 | */
27 | public function down()
28 | {
29 | Schema::drop('password_resets');
30 | }
31 | }
32 |
--------------------------------------------------------------------------------
/apis/stories/database/migrations/2016_03_10_045354_create_stories_table.php:
--------------------------------------------------------------------------------
1 | increments('id');
17 | $table->string('plot');
18 | $table->integer('upvotes')->unsigned();
19 | $table->string('writer');
20 | $table->timestamps();
21 | });
22 | }
23 |
24 | /**
25 | * Reverse the migrations.
26 | *
27 | * @return void
28 | */
29 | public function down()
30 | {
31 | Schema::table('stories', function (Blueprint $table) {
32 | Schema::drop('stories');
33 | });
34 | }
35 | }
36 |
--------------------------------------------------------------------------------
/apis/stories/database/seeds/.gitkeep:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------
/apis/stories/database/seeds/DatabaseSeeder.php:
--------------------------------------------------------------------------------
1 | call(StorySeeder::class);
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/apis/stories/database/seeds/StorySeeder.php:
--------------------------------------------------------------------------------
1 | truncate();
15 | factory(App\Story::class, 20)->create();
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/apis/stories/gulpfile.js:
--------------------------------------------------------------------------------
1 | var elixir = require('laravel-elixir');
2 |
3 | /*
4 | |--------------------------------------------------------------------------
5 | | Elixir Asset Management
6 | |--------------------------------------------------------------------------
7 | |
8 | | Elixir provides a clean, fluent API for defining some basic Gulp tasks
9 | | for your Laravel application. By default, we are compiling the Sass
10 | | file for our application, as well as publishing vendor resources.
11 | |
12 | */
13 |
14 | elixir(function(mix) {
15 | mix.sass('app.scss');
16 | });
17 |
--------------------------------------------------------------------------------
/apis/stories/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "private": true,
3 | "devDependencies": {
4 | "gulp": "^3.8.8"
5 | },
6 | "dependencies": {
7 | "laravel-elixir": "^4.0.0",
8 | "bootstrap-sass": "^3.0.0"
9 | }
10 | }
11 |
--------------------------------------------------------------------------------
/apis/stories/phpunit.xml:
--------------------------------------------------------------------------------
1 |
2 |
11 |
12 |
13 | ./tests/
14 |
15 |
16 |
17 |
18 | app/
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
--------------------------------------------------------------------------------
/apis/stories/public/.htaccess:
--------------------------------------------------------------------------------
1 |
2 |
3 | Options -MultiViews
4 |
5 |
6 | RewriteEngine On
7 |
8 | # Redirect Trailing Slashes If Not A Folder...
9 | RewriteCond %{REQUEST_FILENAME} !-d
10 | RewriteRule ^(.*)/$ /$1 [L,R=301]
11 |
12 | # Handle Front Controller...
13 | RewriteCond %{REQUEST_FILENAME} !-d
14 | RewriteCond %{REQUEST_FILENAME} !-f
15 | RewriteRule ^ index.php [L]
16 |
17 | # Handle Authorization Header
18 | RewriteCond %{HTTP:Authorization} .
19 | RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
20 |
21 |
--------------------------------------------------------------------------------
/apis/stories/public/favicon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hootlex/the-majesty-of-vuejs/30bd16d6ccd51c26f2e120ac099469844a14bdb4/apis/stories/public/favicon.ico
--------------------------------------------------------------------------------
/apis/stories/public/robots.txt:
--------------------------------------------------------------------------------
1 | User-agent: *
2 | Disallow:
3 |
--------------------------------------------------------------------------------
/apis/stories/public/web.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
--------------------------------------------------------------------------------
/apis/stories/readme.md:
--------------------------------------------------------------------------------
1 | This is the API used in the "Consuming an API" part of the book and it is intended for educational use only.
2 |
3 | Contains everything you need to use this API and an installation script for faster implementation.
4 |
5 | This API is built with [Laravel](http://laravel.com)
6 |
--------------------------------------------------------------------------------
/apis/stories/resources/assets/sass/app.scss:
--------------------------------------------------------------------------------
1 | // @import "node_modules/bootstrap-sass/assets/stylesheets/bootstrap";
2 |
3 |
--------------------------------------------------------------------------------
/apis/stories/resources/lang/en/auth.php:
--------------------------------------------------------------------------------
1 | 'These credentials do not match our records.',
17 | 'throttle' => 'Too many login attempts. Please try again in :seconds seconds.',
18 |
19 | ];
20 |
--------------------------------------------------------------------------------
/apis/stories/resources/lang/en/pagination.php:
--------------------------------------------------------------------------------
1 | '« Previous',
17 | 'next' => 'Next »',
18 |
19 | ];
20 |
--------------------------------------------------------------------------------
/apis/stories/resources/lang/en/passwords.php:
--------------------------------------------------------------------------------
1 | 'Passwords must be at least six characters and match the confirmation.',
17 | 'reset' => 'Your password has been reset!',
18 | 'sent' => 'We have e-mailed your password reset link!',
19 | 'token' => 'This password reset token is invalid.',
20 | 'user' => "We can't find a user with that e-mail address.",
21 |
22 | ];
23 |
--------------------------------------------------------------------------------
/apis/stories/resources/views/errors/503.blade.php:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Be right back.
5 |
6 |
7 |
8 |
39 |
40 |
41 |
46 |
47 |
48 |
--------------------------------------------------------------------------------
/apis/stories/resources/views/vendor/.gitkeep:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------
/apis/stories/resources/views/welcome.blade.php:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Laravel
5 |
6 |
7 |
8 |
37 |
38 |
39 |
44 |
45 |
46 |
--------------------------------------------------------------------------------
/apis/stories/server.php:
--------------------------------------------------------------------------------
1 |
8 | */
9 |
10 | $uri = urldecode(
11 | parse_url($_SERVER['REQUEST_URI'], PHP_URL_PATH)
12 | );
13 |
14 | // This file allows us to emulate Apache's "mod_rewrite" functionality from the
15 | // built-in PHP web server. This provides a convenient way to test a Laravel
16 | // application without having installed a "real" web server software here.
17 | if ($uri !== '/' && file_exists(__DIR__.'/public'.$uri)) {
18 | return false;
19 | }
20 |
21 | require_once __DIR__.'/public/index.php';
22 |
--------------------------------------------------------------------------------
/apis/stories/setup.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash;
2 | echo "Begin Setup";
3 |
4 | echo "Install project dependencies...";
5 | composer install || {
6 | echo "Composer not found. Installing Composer...";
7 | php -r "readfile('https://getcomposer.org/installer');" | php;
8 | #mv composer.phar /usr/local/bin/composer -n;
9 | php composer.phar install;
10 | }
11 | echo "Create database";
12 | touch database/database.sqlite;
13 |
14 | echo "Migrate & Seed";
15 | php artisan migrate;
16 | php artisan db:seed;
17 | php artisan serve --port=3000 --host localhost;
--------------------------------------------------------------------------------
/apis/stories/storage/app/.gitignore:
--------------------------------------------------------------------------------
1 | *
2 | !public/
3 | !.gitignore
4 |
--------------------------------------------------------------------------------
/apis/stories/storage/app/public/.gitignore:
--------------------------------------------------------------------------------
1 | *
2 | !.gitignore
3 |
--------------------------------------------------------------------------------
/apis/stories/storage/framework/.gitignore:
--------------------------------------------------------------------------------
1 | config.php
2 | routes.php
3 | compiled.php
4 | services.json
5 | events.scanned.php
6 | routes.scanned.php
7 | down
8 |
--------------------------------------------------------------------------------
/apis/stories/storage/framework/cache/.gitignore:
--------------------------------------------------------------------------------
1 | *
2 | !.gitignore
3 |
--------------------------------------------------------------------------------
/apis/stories/storage/framework/sessions/.gitignore:
--------------------------------------------------------------------------------
1 | *
2 | !.gitignore
3 |
--------------------------------------------------------------------------------
/apis/stories/storage/framework/views/.gitignore:
--------------------------------------------------------------------------------
1 | *
2 | !.gitignore
3 |
--------------------------------------------------------------------------------
/apis/stories/storage/logs/.gitignore:
--------------------------------------------------------------------------------
1 | *
2 | !.gitignore
3 |
--------------------------------------------------------------------------------
/apis/stories/tests/ExampleTest.php:
--------------------------------------------------------------------------------
1 | visit('/')
17 | ->see('Laravel 5');
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/apis/stories/tests/TestCase.php:
--------------------------------------------------------------------------------
1 | make(Illuminate\Contracts\Console\Kernel::class)->bootstrap();
22 |
23 | return $app;
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/examples/14. Mastering Single File Components/14.3 forming vue files/.babelrc:
--------------------------------------------------------------------------------
1 | {
2 | "presets": ["es2015", "stage-2"],
3 | "plugins": ["transform-runtime"],
4 | "comments": false
5 | }
6 |
--------------------------------------------------------------------------------
/examples/14. Mastering Single File Components/14.3 forming vue files/.editorconfig:
--------------------------------------------------------------------------------
1 | root = true
2 |
3 | [*]
4 | charset = utf-8
5 | indent_style = space
6 | indent_size = 2
7 | end_of_line = lf
8 | insert_final_newline = true
9 | trim_trailing_whitespace = true
10 |
--------------------------------------------------------------------------------
/examples/14. Mastering Single File Components/14.3 forming vue files/.eslintignore:
--------------------------------------------------------------------------------
1 | build/*.js
2 | config/*.js
3 |
--------------------------------------------------------------------------------
/examples/14. Mastering Single File Components/14.3 forming vue files/.eslintrc.js:
--------------------------------------------------------------------------------
1 | module.exports = {
2 | root: true,
3 | parser: 'babel-eslint',
4 | parserOptions: {
5 | sourceType: 'module'
6 | },
7 | // https://github.com/feross/standard/blob/master/RULES.md#javascript-standard-style
8 | extends: 'standard',
9 | // required to lint *.vue files
10 | plugins: [
11 | 'html'
12 | ],
13 | // add your custom rules here
14 | 'rules': {
15 | // allow paren-less arrow functions
16 | 'arrow-parens': 0,
17 | // allow async-await
18 | 'generator-star-spacing': 0,
19 | // allow debugger during development
20 | 'no-debugger': process.env.NODE_ENV === 'production' ? 2 : 0
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/examples/14. Mastering Single File Components/14.3 forming vue files/.gitignore:
--------------------------------------------------------------------------------
1 | .DS_Store
2 | node_modules/
3 | dist/
4 | npm-debug.log
5 | selenium-debug.log
6 | test/unit/coverage
7 | test/e2e/reports
8 |
--------------------------------------------------------------------------------
/examples/14. Mastering Single File Components/14.3 forming vue files/README.md:
--------------------------------------------------------------------------------
1 | # y
2 |
3 | > y
4 |
5 | ## Build Setup
6 |
7 | ``` bash
8 | # install dependencies
9 | npm install
10 |
11 | # serve with hot reload at localhost:8080
12 | npm run dev
13 |
14 | # build for production with minification
15 | npm run build
16 |
17 | # run unit tests
18 | npm run unit
19 |
20 | # run e2e tests
21 | npm run e2e
22 |
23 | # run all tests
24 | npm test
25 | ```
26 |
27 | For detailed explanation on how things work, checkout the [guide](http://vuejs-templates.github.io/webpack/) and [docs for vue-loader](http://vuejs.github.io/vue-loader).
28 |
--------------------------------------------------------------------------------
/examples/14. Mastering Single File Components/14.3 forming vue files/build/build.js:
--------------------------------------------------------------------------------
1 | // https://github.com/shelljs/shelljs
2 | require('shelljs/global')
3 | env.NODE_ENV = 'production'
4 |
5 | var path = require('path')
6 | var config = require('../config')
7 | var ora = require('ora')
8 | var webpack = require('webpack')
9 | var webpackConfig = require('./webpack.prod.conf')
10 |
11 | console.log(
12 | ' Tip:\n' +
13 | ' Built files are meant to be served over an HTTP server.\n' +
14 | ' Opening index.html over file:// won\'t work.\n'
15 | )
16 |
17 | var spinner = ora('building for production...')
18 | spinner.start()
19 |
20 | var assetsPath = path.join(config.build.assetsRoot, config.build.assetsSubDirectory)
21 | rm('-rf', assetsPath)
22 | mkdir('-p', assetsPath)
23 | cp('-R', 'static/', assetsPath)
24 |
25 | webpack(webpackConfig, function (err, stats) {
26 | spinner.stop()
27 | if (err) throw err
28 | process.stdout.write(stats.toString({
29 | colors: true,
30 | modules: false,
31 | children: false,
32 | chunks: false,
33 | chunkModules: false
34 | }) + '\n')
35 | })
36 |
--------------------------------------------------------------------------------
/examples/14. Mastering Single File Components/14.3 forming vue files/build/dev-client.js:
--------------------------------------------------------------------------------
1 | /* eslint-disable */
2 | require('eventsource-polyfill')
3 | var hotClient = require('webpack-hot-middleware/client?noInfo=true&reload=true')
4 |
5 | hotClient.subscribe(function (event) {
6 | if (event.action === 'reload') {
7 | window.location.reload()
8 | }
9 | })
10 |
--------------------------------------------------------------------------------
/examples/14. Mastering Single File Components/14.3 forming vue files/build/webpack.dev.conf.js:
--------------------------------------------------------------------------------
1 | var config = require('../config')
2 | var webpack = require('webpack')
3 | var merge = require('webpack-merge')
4 | var utils = require('./utils')
5 | var baseWebpackConfig = require('./webpack.base.conf')
6 | var HtmlWebpackPlugin = require('html-webpack-plugin')
7 |
8 | // add hot-reload related code to entry chunks
9 | Object.keys(baseWebpackConfig.entry).forEach(function (name) {
10 | baseWebpackConfig.entry[name] = ['./build/dev-client'].concat(baseWebpackConfig.entry[name])
11 | })
12 |
13 | module.exports = merge(baseWebpackConfig, {
14 | module: {
15 | loaders: utils.styleLoaders({ sourceMap: config.dev.cssSourceMap })
16 | },
17 | // eval-source-map is faster for development
18 | devtool: '#eval-source-map',
19 | plugins: [
20 | new webpack.DefinePlugin({
21 | 'process.env': config.dev.env
22 | }),
23 | // https://github.com/glenjamin/webpack-hot-middleware#installation--usage
24 | new webpack.optimize.OccurenceOrderPlugin(),
25 | new webpack.HotModuleReplacementPlugin(),
26 | new webpack.NoErrorsPlugin(),
27 | // https://github.com/ampedandwired/html-webpack-plugin
28 | new HtmlWebpackPlugin({
29 | filename: 'index.html',
30 | template: 'index.html',
31 | inject: true
32 | })
33 | ]
34 | })
35 |
--------------------------------------------------------------------------------
/examples/14. Mastering Single File Components/14.3 forming vue files/config/dev.env.js:
--------------------------------------------------------------------------------
1 | var merge = require('webpack-merge')
2 | var prodEnv = require('./prod.env')
3 |
4 | module.exports = merge(prodEnv, {
5 | NODE_ENV: '"development"'
6 | })
7 |
--------------------------------------------------------------------------------
/examples/14. Mastering Single File Components/14.3 forming vue files/config/index.js:
--------------------------------------------------------------------------------
1 | // see http://vuejs-templates.github.io/webpack for documentation.
2 | var path = require('path')
3 |
4 | module.exports = {
5 | build: {
6 | env: require('./prod.env'),
7 | index: path.resolve(__dirname, '../dist/index.html'),
8 | assetsRoot: path.resolve(__dirname, '../dist'),
9 | assetsSubDirectory: 'static',
10 | assetsPublicPath: '/',
11 | productionSourceMap: true,
12 | // Gzip off by default as many popular static hosts such as
13 | // Surge or Netlify already gzip all static assets for you.
14 | // Before setting to `true`, make sure to:
15 | // npm install --save-dev compression-webpack-plugin
16 | productionGzip: false,
17 | productionGzipExtensions: ['js', 'css']
18 | },
19 | dev: {
20 | env: require('./dev.env'),
21 | port: 8080,
22 | assetsSubDirectory: 'static',
23 | assetsPublicPath: '/',
24 | proxyTable: {},
25 | // CSS Sourcemaps off by default because relative paths are "buggy"
26 | // with this option, according to the CSS-Loader README
27 | // (https://github.com/webpack/css-loader#sourcemaps)
28 | // In our experience, they generally work as expected,
29 | // just be aware of this issue when enabling this option.
30 | cssSourceMap: false
31 | }
32 | }
33 |
--------------------------------------------------------------------------------
/examples/14. Mastering Single File Components/14.3 forming vue files/config/prod.env.js:
--------------------------------------------------------------------------------
1 | module.exports = {
2 | NODE_ENV: '"production"'
3 | }
4 |
--------------------------------------------------------------------------------
/examples/14. Mastering Single File Components/14.3 forming vue files/config/test.env.js:
--------------------------------------------------------------------------------
1 | var merge = require('webpack-merge')
2 | var devEnv = require('./dev.env')
3 |
4 | module.exports = merge(devEnv, {
5 | NODE_ENV: '"testing"'
6 | })
7 |
--------------------------------------------------------------------------------
/examples/14. Mastering Single File Components/14.3 forming vue files/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | stories classic
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/examples/14. Mastering Single File Components/14.3 forming vue files/src/App.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |

4 |
5 |
6 |
7 |
8 |
9 |
10 |
22 |
23 |
53 |
--------------------------------------------------------------------------------
/examples/14. Mastering Single File Components/14.3 forming vue files/src/assets/logo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hootlex/the-majesty-of-vuejs/30bd16d6ccd51c26f2e120ac099469844a14bdb4/examples/14. Mastering Single File Components/14.3 forming vue files/src/assets/logo.png
--------------------------------------------------------------------------------
/examples/14. Mastering Single File Components/14.3 forming vue files/src/components/Famous.vue:
--------------------------------------------------------------------------------
1 |
2 | Trending stories({{famous.length}})
3 |
4 | -
5 | {{ story.writer }} said "{{ story.plot }}".
6 | Story upvotes {{ story.upvotes }}.
7 |
8 |
9 |
10 |
11 |
52 |
--------------------------------------------------------------------------------
/examples/14. Mastering Single File Components/14.3 forming vue files/src/components/Hello.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
{{ msg }}
4 |
5 |
6 |
7 |
20 |
21 |
22 |
27 |
--------------------------------------------------------------------------------
/examples/14. Mastering Single File Components/14.3 forming vue files/src/components/Login.vue:
--------------------------------------------------------------------------------
1 |
2 | Sign in
3 |
4 |
5 |
6 |
7 |
8 |
15 |
--------------------------------------------------------------------------------
/examples/14. Mastering Single File Components/14.3 forming vue files/src/components/Register.vue:
--------------------------------------------------------------------------------
1 |
2 | Register Form
3 |
4 |
5 |
6 |
7 |
8 |
9 |
11 |
12 |
23 |
--------------------------------------------------------------------------------
/examples/14. Mastering Single File Components/14.3 forming vue files/src/components/Stories.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 | -
4 | {{ story.writer }} said "{{ story.plot }}"
5 | Story upvotes {{ story.upvotes }}.
6 |
7 |
8 |
9 |
10 |
44 |
--------------------------------------------------------------------------------
/examples/14. Mastering Single File Components/14.3 forming vue files/src/main.js:
--------------------------------------------------------------------------------
1 | import Vue from 'vue'
2 | import App from './App'
3 |
4 | /* eslint-disable no-new */
5 | new Vue({
6 | el: 'body',
7 | components: { App }
8 | })
9 |
--------------------------------------------------------------------------------
/examples/14. Mastering Single File Components/14.3 forming vue files/static/.gitkeep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hootlex/the-majesty-of-vuejs/30bd16d6ccd51c26f2e120ac099469844a14bdb4/examples/14. Mastering Single File Components/14.3 forming vue files/static/.gitkeep
--------------------------------------------------------------------------------
/examples/14. Mastering Single File Components/14.4 Eliminating Duplicate State/src/assets/logo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hootlex/the-majesty-of-vuejs/30bd16d6ccd51c26f2e120ac099469844a14bdb4/examples/14. Mastering Single File Components/14.4 Eliminating Duplicate State/src/assets/logo.png
--------------------------------------------------------------------------------
/examples/14. Mastering Single File Components/14.4 Eliminating Duplicate State/src/components/Famous.vue:
--------------------------------------------------------------------------------
1 |
2 | Trending stories({{famous.length}})
3 |
4 | -
5 | {{ story.writer }} said "{{ story.plot }}".
6 | Story upvotes {{ story.upvotes }}.
7 |
8 |
9 |
10 |
11 |
22 |
--------------------------------------------------------------------------------
/examples/14. Mastering Single File Components/14.4 Eliminating Duplicate State/src/components/Hello.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
{{ msg }}
4 |
5 |
6 |
7 |
20 |
21 |
22 |
27 |
--------------------------------------------------------------------------------
/examples/14. Mastering Single File Components/14.4 Eliminating Duplicate State/src/components/Login.vue:
--------------------------------------------------------------------------------
1 |
2 | Sign in
3 |
4 |
5 |
6 |
7 |
8 |
15 |
--------------------------------------------------------------------------------
/examples/14. Mastering Single File Components/14.4 Eliminating Duplicate State/src/components/Register.vue:
--------------------------------------------------------------------------------
1 |
2 | Register Form
3 |
4 |
5 |
6 |
7 |
8 |
9 |
11 |
12 |
23 |
--------------------------------------------------------------------------------
/examples/14. Mastering Single File Components/14.4 Eliminating Duplicate State/src/components/Stories.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 | -
4 | {{ story.writer }} said "{{ story.plot }}"
5 | Story upvotes {{ story.upvotes }}.
6 |
7 |
8 |
9 |
10 |
15 |
--------------------------------------------------------------------------------
/examples/14. Mastering Single File Components/14.4 Eliminating Duplicate State/src/main.js:
--------------------------------------------------------------------------------
1 | import Vue from 'vue'
2 | import App from './App'
3 |
4 | /* eslint-disable no-new */
5 | new Vue({
6 | el: 'body',
7 | components: { App }
8 | })
9 |
--------------------------------------------------------------------------------
/examples/14. Mastering Single File Components/14.4.2 Global Store/src/App.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |

4 |
5 |
6 |
7 |
8 |
9 |
10 |
23 |
24 |
54 |
--------------------------------------------------------------------------------
/examples/14. Mastering Single File Components/14.4.2 Global Store/src/assets/logo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hootlex/the-majesty-of-vuejs/30bd16d6ccd51c26f2e120ac099469844a14bdb4/examples/14. Mastering Single File Components/14.4.2 Global Store/src/assets/logo.png
--------------------------------------------------------------------------------
/examples/14. Mastering Single File Components/14.4.2 Global Store/src/components/Famous.vue:
--------------------------------------------------------------------------------
1 |
2 | Trending stories({{famous.length}})
3 |
4 | -
5 | {{ story.writer }} said "{{ story.plot }}".
6 | Story upvotes {{ story.upvotes }}.
7 |
8 |
9 |
10 |
11 |
29 |
--------------------------------------------------------------------------------
/examples/14. Mastering Single File Components/14.4.2 Global Store/src/components/Hello.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
{{ msg }}
4 |
5 |
6 |
7 |
20 |
21 |
22 |
27 |
--------------------------------------------------------------------------------
/examples/14. Mastering Single File Components/14.4.2 Global Store/src/components/Login.vue:
--------------------------------------------------------------------------------
1 |
2 | Sign in
3 |
4 |
5 |
6 |
7 |
8 |
15 |
--------------------------------------------------------------------------------
/examples/14. Mastering Single File Components/14.4.2 Global Store/src/components/Register.vue:
--------------------------------------------------------------------------------
1 |
2 | Register Form
3 |
4 |
5 |
6 |
7 |
8 |
9 |
11 |
12 |
23 |
--------------------------------------------------------------------------------
/examples/14. Mastering Single File Components/14.4.2 Global Store/src/components/Stories.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 | -
4 | {{ story.writer }} said "{{ story.plot }}"
5 | Story upvotes {{ story.upvotes }}.
6 |
7 |
8 |
9 |
10 |
18 |
--------------------------------------------------------------------------------
/examples/14. Mastering Single File Components/14.4.2 Global Store/src/main.js:
--------------------------------------------------------------------------------
1 | import Vue from 'vue'
2 | import App from './App'
3 |
4 | /* eslint-disable no-new */
5 | new Vue({
6 | el: 'body',
7 | components: { App }
8 | })
9 |
--------------------------------------------------------------------------------
/examples/14. Mastering Single File Components/14.4.2 Global Store/src/store.js:
--------------------------------------------------------------------------------
1 | export const store = {
2 | stories: [
3 | {
4 | plot: 'My horse is amazing.',
5 | writer: 'Mr. Weebl',
6 | upvotes: 28,
7 | voted: false
8 | },
9 | {
10 | plot: 'Narwhals invented Shish Kebab.',
11 | writer: 'Mr. Weebl',
12 | upvotes: 8,
13 | voted: false
14 | },
15 | {
16 | plot: 'The dark side of the Force is stronger.',
17 | writer: 'Darth Vader',
18 | upvotes: 52,
19 | voted: false
20 | },
21 | {
22 | plot: 'One does not simply walk into Mordor',
23 | writer: 'Boromir',
24 | upvotes: 74,
25 | voted: false
26 | }
27 | ]
28 | }
29 |
--------------------------------------------------------------------------------
/examples/15. Swapping Components/App.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |

4 |
Welcome to dynamic Components!
5 |
12 |
13 |
14 |
15 |
16 |
49 |
--------------------------------------------------------------------------------
/examples/16. Vue router/16.2 Usage/App.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |

4 |
Welcome to Routing!
5 |
Home
6 |
Login
7 |
8 |
9 |
10 |
11 |
12 |
22 |
--------------------------------------------------------------------------------
/examples/16. Vue router/16.2 Usage/main.js:
--------------------------------------------------------------------------------
1 | import Vue from 'vue'
2 | import App from './App'
3 | import VueRouter from 'vue-router'
4 |
5 | Vue.use(VueRouter)
6 | var router = new VueRouter()
7 | router.map({
8 | '/': {
9 | component: require('./components/Hello.vue')
10 | },
11 | '/login': {
12 | component: require('./components/Login.vue')
13 | }
14 | })
15 | router.start(App, 'body')
16 |
--------------------------------------------------------------------------------
/examples/16. Vue router/16.3 Nested Router/App.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |

4 |
Welcome to Routing!
5 |
Home
6 |
Login
7 |
8 |
9 |
10 |
11 |
12 |
22 |
--------------------------------------------------------------------------------
/examples/16. Vue router/16.3 Nested Router/Stories.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 | -
4 | {{ story.writer }} said "{{ story.plot }}"
5 | Story upvotes {{ story.upvotes }}.
6 |
7 |
8 | // nested outlet
9 |
10 | Trending stories
11 |
12 |
13 |
23 |
--------------------------------------------------------------------------------
/examples/16. Vue router/16.3 Nested Router/main.js:
--------------------------------------------------------------------------------
1 | import Vue from 'vue'
2 | import App from './App'
3 | import VueRouter from 'vue-router'
4 |
5 | Vue.use(VueRouter)
6 | var router = new VueRouter()
7 |
8 | router.map({
9 | '/': {
10 | component: require('./components/Hello.vue')
11 | },
12 | '/login': {
13 | component: require('./components/Login.vue')
14 | },
15 | '/stories': {
16 | component: require('./components/Stories.vue'),
17 | subRoutes: {
18 | '/famous': {
19 | component: require('./components/Famous.vue')
20 | },
21 | }
22 | },
23 | })
24 |
25 | router.start(App, 'body')
26 |
--------------------------------------------------------------------------------
/examples/16. Vue router/16.4 Route Matching/16.4.1 Named Routes/App.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |

4 |
Welcome to Routing!
5 |
6 |
Home
7 |
Login
8 |
9 |
10 |
11 |
12 |
13 |
23 |
--------------------------------------------------------------------------------
/examples/16. Vue router/16.4 Route Matching/16.4.1 Named Routes/main.js:
--------------------------------------------------------------------------------
1 | import Vue from 'vue'
2 | import App from './App'
3 | import VueRouter from 'vue-router'
4 |
5 | Vue.use(VueRouter)
6 | var router = new VueRouter({
7 | history: true,
8 | root: '/'
9 | })
10 |
11 | router.map({
12 | '/': {
13 | name: 'home', // give the route a name
14 | component: require('./components/Hello.vue')
15 | },
16 | '/login': {
17 | name: 'login', // give the route a name
18 | component: require('./components/Login.vue')
19 | },
20 | '/stories': {
21 | name: 'stories',
22 | component: require('./components/Stories.vue'),
23 | subRoutes: {
24 | '/famous': {
25 | component: require('./components/Famous.vue')
26 | },
27 | }
28 | },
29 | })
30 |
31 | router.start(App, 'body')
32 |
--------------------------------------------------------------------------------
/examples/16. Vue router/16.4 Route Matching/16.4.2 Route Object/App.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |

4 |
Welcome to Routing!
5 |
6 |
Home
7 |
Login
8 |
9 |
10 |
11 |
12 |
13 |
23 |
--------------------------------------------------------------------------------
/examples/16. Vue router/16.4 Route Matching/16.4.2 Route Object/Edit.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
{{ story.writer }} said "{{ story.plot }}"
4 |
5 | Story upvotes {{ story.upvotes }}
6 |
7 |
8 |
9 |
28 |
--------------------------------------------------------------------------------
/examples/16. Vue router/16.4 Route Matching/16.4.2 Route Object/Stories.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 | -
4 |
{{ story.writer }} said "{{ story.plot }}"
5 |
10 | Story upvotes {{ story.upvotes }}
11 |
12 |
13 |
14 |
15 |
16 |
28 |
--------------------------------------------------------------------------------
/examples/16. Vue router/16.4 Route Matching/16.4.2 Route Object/main.js:
--------------------------------------------------------------------------------
1 | import Vue from 'vue'
2 | import App from './App'
3 | import VueRouter from 'vue-router'
4 |
5 | Vue.use(VueRouter)
6 | var router = new VueRouter({
7 | history: true,
8 | root: '/'
9 | })
10 |
11 | router.map({
12 | '/': {
13 | name: 'home',
14 | component: require('./components/Hello.vue')
15 | },
16 | '/login': {
17 | name: 'login',
18 | component: require('./components/Login.vue')
19 | },
20 | '/stories': {
21 | name: 'stories',
22 | component: require('./components/Stories.vue'),
23 | subRoutes: {
24 | '/famous': {
25 | component: require('./components/Famous.vue')
26 | },
27 | }
28 | },
29 | '/stories/:storyId/edit': {
30 | name: 'edit',
31 | component: require('./components/Edit.vue'),
32 | },
33 | })
34 |
35 | router.start(App, 'body')
36 |
--------------------------------------------------------------------------------
/examples/16. Vue router/16.4 Route Matching/16.4.4 Route Alias/main.js:
--------------------------------------------------------------------------------
1 | import Vue from 'vue'
2 | import App from './App'
3 | import VueRouter from 'vue-router'
4 |
5 | Vue.use(VueRouter)
6 | var router = new VueRouter({
7 | history: true,
8 | root: '/'
9 | })
10 |
11 | router.map({
12 | '/': {
13 | name: 'home',
14 | component: require('./components/Hello.vue')
15 | },
16 | '/login': {
17 | name: 'login',
18 | component: require('./components/Login.vue')
19 | },
20 | '/stories': {
21 | name: 'stories',
22 | component: require('./components/Stories.vue'),
23 | subRoutes: {
24 | '/famous': {
25 | component: require('./components/Famous.vue')
26 | },
27 | }
28 | },
29 | '/stories/:storyId/edit': {
30 | name: 'edit',
31 | component: require('./components/Edit.vue'),
32 | },
33 | })
34 |
35 | router.alias({
36 | // match '/stories/:storyId' as if it is '/stories/:storyId/edit'
37 | '/stories/:storyId': '/stories/:storyId/edit'
38 | })
39 |
40 | router.start(App, 'body')
41 |
--------------------------------------------------------------------------------
/examples/16. Vue router/16.4 Route Matching/16.4.5 Route Go/Edit.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
{{ story.writer }} said "{{ story.plot }}"
4 |
5 | Story upvotes {{ story.upvotes }}
6 |
7 |
8 |
9 |
10 |
31 |
--------------------------------------------------------------------------------
/examples/16. Vue router/16.4 Route Matching/16.4.6 Filtering Transitions/main.js:
--------------------------------------------------------------------------------
1 | import Vue from 'vue'
2 | import App from './App'
3 | import VueRouter from 'vue-router'
4 |
5 | Vue.use(VueRouter)
6 | var router = new VueRouter({
7 | history: true,
8 | root: '/'
9 | })
10 |
11 | router.map({
12 | '/': {
13 | name: 'home',
14 | component: require('./components/Hello.vue')
15 | },
16 | '/login': {
17 | name: 'login',
18 | component: require('./components/Login.vue')
19 | },
20 | '/stories': {
21 | name: 'stories',
22 | component: require('./components/Stories.vue'),
23 | subRoutes: {
24 | '/famous': {
25 | component: require('./components/Famous.vue')
26 | },
27 | }
28 | },
29 | '/stories/:storyId/edit': {
30 | name: 'edit',
31 | component: require('./components/Edit.vue'),
32 | },
33 | })
34 |
35 | // create a dummy user object
36 | var User = {
37 | isAdmin: false
38 | }
39 |
40 | router.beforeEach(function (transition) {
41 | if (transition.to.path != '/login' && !User.isAdmin) {
42 | // if not going to login and not an admin redirect to login
43 | router.go('/login')
44 | } else {
45 | //if authorized proceed
46 | transition.next()
47 | }
48 | })
49 |
50 | router.start(App, 'body')
51 |
--------------------------------------------------------------------------------
/examples/2. Getting started/2.2-two-way-binding.html:
--------------------------------------------------------------------------------
1 |
2 |
3 | Hello Vue
4 |
5 |
6 |
7 |
{{ message }}
8 |
9 |
10 |
11 |
14 |
22 |
23 |
--------------------------------------------------------------------------------
/examples/3. A Flavor Of Directives/3.1-v-show.html:
--------------------------------------------------------------------------------
1 |
2 |
3 | Hello Vue
4 |
5 |
6 |
7 |
You must send a message for help!
8 |
9 |
12 |
13 | {{$data | json}}
14 |
15 |
16 |
17 |
18 |
26 |
27 |
--------------------------------------------------------------------------------
/examples/3. A Flavor Of Directives/3.2-template-v-if.html:
--------------------------------------------------------------------------------
1 |
2 |
3 | Hello Vue
4 |
5 |
6 |
7 |
8 | You must send a message for help!
9 | Dispatch a messenger immediately!
10 | To nearby kingdom of Hearts!
11 |
12 |
13 |
16 |
17 | {{$data | json}}
18 |
19 |
20 |
21 |
22 |
30 |
31 |
--------------------------------------------------------------------------------
/examples/3. A Flavor Of Directives/3.3-v-if-v-else.html:
--------------------------------------------------------------------------------
1 |
2 |
3 | Hello Vue
4 |
5 |
6 |
7 |
You must send a message for help!
8 |
You have sent a message!
9 |
10 |
13 |
14 | {{$data | json}}
15 |
16 |
17 |
18 |
19 |
20 |
28 |
29 |
--------------------------------------------------------------------------------
/examples/4. List Rendering/4.2.1-range-v-for.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Hello Vue
5 |
6 |
7 |
8 |
The multiplication table of 4.
9 |
10 | -
11 | {{ i }} times 4 equals {{ i * 4 }}.
12 |
13 |
14 |
15 |
16 |
17 |
22 |
23 |
--------------------------------------------------------------------------------
/examples/4. List Rendering/4.3.1-loop-through-array.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Stories
5 |
6 |
7 |
8 |
Let's hear some stories!
9 |
10 |
11 | -
14 | {{index}} {{ story.writer }} said "{{ story.plot }}"
15 |
16 |
17 |
18 |
19 | {{$data | json}}
20 |
21 |
22 |
23 |
24 |
49 |
50 |
--------------------------------------------------------------------------------
/examples/4. List Rendering/4.4-object-v-for.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Stories
5 |
6 |
7 |
8 |
Let's hear some stories!
9 |
10 | -
13 | {{$index}} : {{key}} : {{ value }}
14 |
15 |
16 |
17 |
18 |
19 |
31 |
32 |
--------------------------------------------------------------------------------
/examples/4. List Rendering/4.6-ordered-results.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Famous Stories
5 |
6 |
7 |
8 |
Let's hear some stories!
9 |
10 | -
13 | {{ story.writer }} said "{{ story.plot }}"
14 | and upvoted {{ story.upvotes }} times.
15 |
16 |
17 |
18 | {{ $data | json }}
19 |
20 |
21 |
22 |
23 |
52 |
53 |
--------------------------------------------------------------------------------
/examples/4. List Rendering/4.7-custom-filter.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Famous Stories
5 |
6 |
7 |
8 |
Let's hear some famous stories!
9 |
10 | -
13 | {{ story.writer }} said "{{ story.plot }}"
14 | and upvoted {{ story.upvotes }} times.
15 |
16 |
17 |
18 | {{ $data | json }}
19 |
20 |
21 |
22 |
23 |
58 |
59 |
--------------------------------------------------------------------------------
/examples/5. Interactivity/5.1.2-methodHandler-v-on.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Upvote
5 |
6 |
7 |
8 |
11 |
12 |
13 |
14 |
29 |
30 |
--------------------------------------------------------------------------------
/examples/5. Interactivity/5.4.1-Computed-Properties-Filter-Array.html:
--------------------------------------------------------------------------------
1 |
2 |
3 | Calculator
4 |
5 |
6 |
7 |
8 |
Let's hear some famous stories! ({{famous.length}})
9 |
10 | -
13 | {{ story.writer }} said "{{ story.plot }}"
14 | and upvoted {{ story.upvotes }} times.
15 |
16 |
17 |
18 |
19 |
20 |
56 |
57 |
--------------------------------------------------------------------------------
/examples/6. Components/6.2-single-component.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Hello Vue
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
21 |
22 |
--------------------------------------------------------------------------------
/examples/6. Components/6.4-component-properties.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Awesome Stories
5 |
6 |
7 |
8 |
9 |
10 |
12 |
13 |
15 |
16 |
17 | {{ story.writer }} said "{{ story.plot }}"
18 |
19 |
20 |
21 |
22 |
32 |
33 |
--------------------------------------------------------------------------------
/examples/6. Components/6.6-stories-component.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Hello Vue
5 |
6 |
7 |
8 |
9 |
Let's hear some stories!
10 |
13 |
{{ $data | json }}
14 |
15 |
16 |
17 |
18 | {{ story.writer }} said "{{ story.plot }}"
19 |
20 |
21 |
22 |
23 |
53 |
54 |
--------------------------------------------------------------------------------
/examples/7. Class and Style Bindings/7.1.1-flip-color.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Hello Vue
5 |
6 |
9 |
12 |
13 |
14 |
27 |
35 |
36 |
--------------------------------------------------------------------------------
/examples/7. Class and Style Bindings/7.2.1-style-binding-object.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Hello Vue
5 |
6 |
7 | Such nice styles my Lord!
8 |
9 |
10 |
22 |
23 |
--------------------------------------------------------------------------------
/examples/7. Class and Style Bindings/7.2.2-style-binding-array.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Hello Vue
5 |
6 |
7 | Such nice styles my Lord!
8 |
9 |
10 |
26 |
27 |
--------------------------------------------------------------------------------
/examples/7. Class and Style Bindings/7.3-bindings-in-action.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Hello Vue
5 |
6 |
7 |
8 | -
11 | {{task.body}}
12 |
15 |
16 |
17 |
18 |
19 |
39 |
44 |
45 |
--------------------------------------------------------------------------------
/homework/chapter13/chapter13.1/.babelrc:
--------------------------------------------------------------------------------
1 | { "presets": ["es2015"] }
2 |
--------------------------------------------------------------------------------
/homework/chapter13/chapter13.1/.gitignore:
--------------------------------------------------------------------------------
1 | node_modules/
--------------------------------------------------------------------------------
/homework/chapter13/chapter13.1/assets/js/ninja.js:
--------------------------------------------------------------------------------
1 | 'use strict';
2 |
3 | var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
4 |
5 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
6 |
7 | var Ninja = function () {
8 | function Ninja(name) {
9 | _classCallCheck(this, Ninja);
10 |
11 | this.name = name;
12 | }
13 |
14 | _createClass(Ninja, [{
15 | key: 'announce',
16 | value: function announce() {
17 | return 'Ninja ' + this.name + ' is here!';
18 | // equivalent to:
19 | // return 'Ninja turtle ' + this.name + ' is here!';
20 | }
21 | }]);
22 |
23 | return Ninja;
24 | }();
25 |
26 | alert(new Ninja('Leonardo').announce());
--------------------------------------------------------------------------------
/homework/chapter13/chapter13.1/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Ninjas Approaching
6 |
7 |
8 |
9 | Ninjas Approaching!
10 |
11 |
12 |
13 |
14 |
--------------------------------------------------------------------------------
/homework/chapter13/chapter13.1/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "scripts": {
3 | "build": "babel src -d assets/js"
4 | },
5 | "devDependencies": {
6 | "babel-cli": "^6.8.0",
7 | "babel-preset-es2015": "^6.6.0"
8 | }
9 | }
10 |
--------------------------------------------------------------------------------
/homework/chapter13/chapter13.1/readme.md:
--------------------------------------------------------------------------------
1 | # Compiling ES6 with Babel
2 |
3 | To run it locally you have to run:
4 |
5 | ```bash
6 | npm install
7 | npm run build
8 | ```
9 |
--------------------------------------------------------------------------------
/homework/chapter13/chapter13.1/src/ninja.js:
--------------------------------------------------------------------------------
1 | class Ninja {
2 | constructor(name) {
3 | this.name = name;
4 | }
5 |
6 | announce() {
7 | alert(`Ninja ${this.name} is here!`)
8 |
9 | // equivalent to:
10 | // alert('Ninja turtle ' + this.name + ' is here!')
11 | }
12 | }
13 |
14 | new Ninja('Leonardo').announce();
15 |
16 |
--------------------------------------------------------------------------------
/homework/chapter13/chapter13.2/.babelrc:
--------------------------------------------------------------------------------
1 | { "presets": ["es2015"] }
2 |
--------------------------------------------------------------------------------
/homework/chapter13/chapter13.2/.gitignore:
--------------------------------------------------------------------------------
1 | node_modules/
--------------------------------------------------------------------------------
/homework/chapter13/chapter13.2/assets/js/ninja.js:
--------------------------------------------------------------------------------
1 | 'use strict';
2 |
3 | var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
4 |
5 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
6 |
7 | var Ninja = function () {
8 | function Ninja(name) {
9 | _classCallCheck(this, Ninja);
10 |
11 | this.name = name;
12 | }
13 |
14 | _createClass(Ninja, [{
15 | key: 'announce',
16 | value: function announce() {
17 | alert('Ninja ' + this.name + ' is here!');
18 |
19 | // equivalent to:
20 | // alert('Ninja turtle ' + this.name + ' is here!')
21 | }
22 | }]);
23 |
24 | return Ninja;
25 | }();
26 |
27 | new Ninja('Leonardo').announce();
--------------------------------------------------------------------------------
/homework/chapter13/chapter13.2/gulpfile.js:
--------------------------------------------------------------------------------
1 | const gulp = require('gulp');
2 | const babel = require('gulp-babel');
3 |
4 | gulp.task('default', ['watch']);
5 |
6 | //basic babel task
7 | gulp.task('babel', function() {
8 | return gulp.src('src/*.js')
9 | .pipe(babel({
10 | presets: ['es2015']
11 | }))
12 | .pipe(gulp.dest('assets/js/'))
13 | })
14 |
15 | //the watch task
16 | gulp.task('watch', function() {
17 | gulp.watch('src/*.js', ['babel']);
18 | })
19 |
--------------------------------------------------------------------------------
/homework/chapter13/chapter13.2/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Ninjas Approaching
6 |
7 |
8 |
9 | Ninjas Approaching!
10 |
11 |
12 |
13 |
14 |
--------------------------------------------------------------------------------
/homework/chapter13/chapter13.2/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "scripts": {
3 | "build": "babel src -d assets/js"
4 | },
5 | "devDependencies": {
6 | "babel-cli": "^6.8.0",
7 | "babel-preset-es2015": "^6.6.0",
8 | "gulp": "^3.9.1",
9 | "gulp-babel": "^6.1.2"
10 | }
11 | }
12 |
--------------------------------------------------------------------------------
/homework/chapter13/chapter13.2/readme.md:
--------------------------------------------------------------------------------
1 | # Workflow Automation with Gulp
2 |
3 | To run it locally you have to run:
4 |
5 | ```bash
6 | npm install
7 | gulp watch
8 | ```
9 |
--------------------------------------------------------------------------------
/homework/chapter13/chapter13.2/src/ninja.js:
--------------------------------------------------------------------------------
1 | class Ninja {
2 | constructor(name) {
3 | this.name = name;
4 | }
5 |
6 | announce() {
7 | alert(`Ninja ${this.name} is here!`)
8 |
9 | // equivalent to:
10 | // alert('Ninja turtle ' + this.name + ' is here!')
11 | }
12 | }
13 |
14 | new Ninja('Leonardo').announce();
15 |
--------------------------------------------------------------------------------
/homework/chapter16/.babelrc:
--------------------------------------------------------------------------------
1 | {
2 | "presets": ["es2015", "stage-2"],
3 | "plugins": ["transform-runtime"],
4 | "comments": false
5 | }
6 |
--------------------------------------------------------------------------------
/homework/chapter16/.editorconfig:
--------------------------------------------------------------------------------
1 | root = true
2 |
3 | [*]
4 | charset = utf-8
5 | indent_style = space
6 | indent_size = 2
7 | end_of_line = lf
8 | insert_final_newline = true
9 | trim_trailing_whitespace = true
10 |
--------------------------------------------------------------------------------
/homework/chapter16/.eslintignore:
--------------------------------------------------------------------------------
1 | build/*.js
2 | config/*.js
3 |
--------------------------------------------------------------------------------
/homework/chapter16/.gitignore:
--------------------------------------------------------------------------------
1 | .DS_Store
2 | node_modules/
3 | dist/
4 | npm-debug.log
5 | selenium-debug.log
6 | test/unit/coverage
7 | test/e2e/reports
8 |
--------------------------------------------------------------------------------
/homework/chapter16/README.md:
--------------------------------------------------------------------------------
1 | # Chapter 16
2 |
3 | > homework
4 |
5 |
6 | ## To run locally
7 |
8 | ``` bash
9 | # install dependencies
10 | npm install
11 |
12 | # serve at localhost:8080
13 | npm run dev
14 |
15 | ```
16 |
17 |
--------------------------------------------------------------------------------
/homework/chapter16/build/build.js:
--------------------------------------------------------------------------------
1 | // https://github.com/shelljs/shelljs
2 | require('shelljs/global')
3 | env.NODE_ENV = 'production'
4 |
5 | var path = require('path')
6 | var config = require('../config')
7 | var ora = require('ora')
8 | var webpack = require('webpack')
9 | var webpackConfig = require('./webpack.prod.conf')
10 |
11 | console.log(
12 | ' Tip:\n' +
13 | ' Built files are meant to be served over an HTTP server.\n' +
14 | ' Opening index.html over file:// won\'t work.\n'
15 | )
16 |
17 | var spinner = ora('building for production...')
18 | spinner.start()
19 |
20 | var assetsPath = path.join(config.build.assetsRoot, config.build.assetsSubDirectory)
21 | rm('-rf', assetsPath)
22 | mkdir('-p', assetsPath)
23 | cp('-R', 'static/', assetsPath)
24 |
25 | webpack(webpackConfig, function (err, stats) {
26 | spinner.stop()
27 | if (err) throw err
28 | process.stdout.write(stats.toString({
29 | colors: true,
30 | modules: false,
31 | children: false,
32 | chunks: false,
33 | chunkModules: false
34 | }) + '\n')
35 | })
36 |
--------------------------------------------------------------------------------
/homework/chapter16/build/dev-client.js:
--------------------------------------------------------------------------------
1 | /* eslint-disable */
2 | require('eventsource-polyfill')
3 | var hotClient = require('webpack-hot-middleware/client?noInfo=true&reload=true')
4 |
5 | hotClient.subscribe(function (event) {
6 | if (event.action === 'reload') {
7 | window.location.reload()
8 | }
9 | })
10 |
--------------------------------------------------------------------------------
/homework/chapter16/build/webpack.dev.conf.js:
--------------------------------------------------------------------------------
1 | var config = require('../config')
2 | var webpack = require('webpack')
3 | var merge = require('webpack-merge')
4 | var utils = require('./utils')
5 | var baseWebpackConfig = require('./webpack.base.conf')
6 | var HtmlWebpackPlugin = require('html-webpack-plugin')
7 |
8 | // add hot-reload related code to entry chunks
9 | Object.keys(baseWebpackConfig.entry).forEach(function (name) {
10 | baseWebpackConfig.entry[name] = ['./build/dev-client'].concat(baseWebpackConfig.entry[name])
11 | })
12 |
13 | module.exports = merge(baseWebpackConfig, {
14 | module: {
15 | loaders: utils.styleLoaders()
16 | },
17 | // eval-source-map is faster for development
18 | devtool: '#eval-source-map',
19 | plugins: [
20 | new webpack.DefinePlugin({
21 | 'process.env': config.dev.env
22 | }),
23 | // https://github.com/glenjamin/webpack-hot-middleware#installation--usage
24 | new webpack.optimize.OccurenceOrderPlugin(),
25 | new webpack.HotModuleReplacementPlugin(),
26 | new webpack.NoErrorsPlugin(),
27 | // https://github.com/ampedandwired/html-webpack-plugin
28 | new HtmlWebpackPlugin({
29 | filename: 'index.html',
30 | template: 'index.html',
31 | inject: true
32 | })
33 | ]
34 | })
35 |
--------------------------------------------------------------------------------
/homework/chapter16/config/dev.env.js:
--------------------------------------------------------------------------------
1 | var merge = require('webpack-merge')
2 | var prodEnv = require('./prod.env')
3 |
4 | module.exports = merge(prodEnv, {
5 | NODE_ENV: '"development"'
6 | })
7 |
--------------------------------------------------------------------------------
/homework/chapter16/config/index.js:
--------------------------------------------------------------------------------
1 | // see http://vuejs-templates.github.io/webpack for documentation.
2 | var path = require('path')
3 |
4 | module.exports = {
5 | build: {
6 | env: require('./prod.env'),
7 | index: path.resolve(__dirname, '../dist/index.html'),
8 | assetsRoot: path.resolve(__dirname, '../dist'),
9 | assetsSubDirectory: 'static',
10 | assetsPublicPath: '/',
11 | productionSourceMap: true,
12 | // Gzip off by default as many popular static hosts such as
13 | // Surge or Netlify already gzip all static assets for you.
14 | // Before setting to `true`, make sure to:
15 | // npm install --save-dev compression-webpack-plugin
16 | productionGzip: false,
17 | productionGzipExtensions: ['js', 'css']
18 | },
19 | dev: {
20 | env: require('./dev.env'),
21 | port: 8080,
22 | assetsSubDirectory: 'static',
23 | assetsPublicPath: '/',
24 | proxyTable: {}
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/homework/chapter16/config/prod.env.js:
--------------------------------------------------------------------------------
1 | module.exports = {
2 | NODE_ENV: '"production"'
3 | }
4 |
--------------------------------------------------------------------------------
/homework/chapter16/config/test.env.js:
--------------------------------------------------------------------------------
1 | var merge = require('webpack-merge')
2 | var devEnv = require('./dev.env')
3 |
4 | module.exports = merge(devEnv, {
5 | NODE_ENV: '"testing"'
6 | })
7 |
--------------------------------------------------------------------------------
/homework/chapter16/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 | Gotta catch them all!
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
--------------------------------------------------------------------------------
/homework/chapter16/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "y",
3 | "version": "1.0.0",
4 | "description": "homework",
5 | "author": "n",
6 | "private": true,
7 | "scripts": {
8 | "dev": "node build/dev-server.js",
9 | "build": "node build/build.js",
10 | "test": ""
11 | },
12 | "dependencies": {
13 | "vue": "^1.0.21",
14 | "babel-runtime": "^6.0.0"
15 | },
16 | "devDependencies": {
17 | "babel-core": "^6.0.0",
18 | "babel-loader": "^6.0.0",
19 | "babel-plugin-transform-runtime": "^6.0.0",
20 | "babel-preset-es2015": "^6.0.0",
21 | "babel-preset-stage-2": "^6.0.0",
22 | "connect-history-api-fallback": "^1.1.0",
23 | "css-loader": "^0.23.0",
24 | "eventsource-polyfill": "^0.9.6",
25 | "express": "^4.13.3",
26 | "extract-text-webpack-plugin": "^1.0.1",
27 | "file-loader": "^0.8.4",
28 | "function-bind": "^1.0.2",
29 | "html-webpack-plugin": "^2.8.1",
30 | "http-proxy-middleware": "^0.12.0",
31 | "json-loader": "^0.5.4",
32 | "ora": "^0.2.0",
33 | "shelljs": "^0.6.0",
34 | "url-loader": "^0.5.7",
35 | "vue-hot-reload-api": "^1.2.0",
36 | "vue-html-loader": "^1.0.0",
37 | "vue-loader": "^8.3.0",
38 | "vue-router": "^0.7.13",
39 | "vue-style-loader": "^1.0.0",
40 | "webpack": "^1.12.2",
41 | "webpack-dev-middleware": "^1.4.0",
42 | "webpack-hot-middleware": "^2.6.0",
43 | "webpack-merge": "^0.8.3"
44 | }
45 | }
46 |
--------------------------------------------------------------------------------
/homework/chapter16/src/App.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Welcome to Palet town!
5 |
6 |
7 |
8 |
9 |
10 |
16 |
17 |
47 |
--------------------------------------------------------------------------------
/homework/chapter16/src/components/Category.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
Category: {{category.name}}
4 |
5 | -
6 |
{{ pokemon.name }}
Level: {{pokemon.level}}
7 |
8 |
9 |
10 |
11 |
16 |
17 |
18 |
19 |
20 |
42 |
43 |
44 |
49 |
--------------------------------------------------------------------------------
/homework/chapter16/src/components/Create.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
Add a new pokemon!
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
42 |
43 |
44 |
49 |
--------------------------------------------------------------------------------
/homework/chapter16/src/components/Home.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
All categories of pokemon
4 |
5 | -
6 |
{{ type.name }} ({{type.pokemons.length}})
7 |
8 |
9 |
10 |
11 |
12 |
13 |
24 |
29 |
--------------------------------------------------------------------------------
/homework/chapter16/src/main.js:
--------------------------------------------------------------------------------
1 | import Vue from 'vue'
2 | import App from './App.vue'
3 | import VueRouter from 'vue-router'
4 |
5 | Vue.use(VueRouter)
6 |
7 | let router = new VueRouter({
8 | history: true,
9 | root: '/'
10 | })
11 |
12 | router.map({
13 | '/': {
14 | component: require('./components/Home.vue')
15 | },
16 | '/category/:name': {
17 | name: 'show',
18 | component: require('./components/Category.vue'),
19 | subRoutes: {
20 | '/pokemons/new': {
21 | component: require('./components/Create.vue')
22 | },
23 | }
24 | },
25 | })
26 |
27 | router.beforeEach(function (transition) {
28 | console.log('You are heading to: ' + transition.to.path)
29 | transition.next()
30 | })
31 |
32 | router.start(App, 'body')
33 |
--------------------------------------------------------------------------------
/homework/chapter16/src/pokedex.js:
--------------------------------------------------------------------------------
1 | export let pokedex = {
2 | categories: [{
3 | name: 'Fire',
4 | pokemons: [{
5 | level: '06',
6 | name: 'Charmander'
7 | },
8 | {
9 | level: '12',
10 | name: 'Vulpix'
11 | },
12 | {
13 | level: '10',
14 | name: 'Magmar'
15 | },
16 | {
17 | level: '22',
18 | name: 'Cyndaquil'
19 | }
20 | ]
21 | },
22 | {
23 | name: 'Water',
24 | pokemons: [{
25 | level: '03',
26 | name: 'Squirtle'
27 | },
28 | {
29 | level: '45',
30 | name: 'Blastoise'
31 | },
32 | {
33 | level: '09',
34 | name: 'Staryu'
35 | },
36 | {
37 | level: '26',
38 | name: 'Gyarados'
39 | },
40 | {
41 | level: '29',
42 | name: 'Tentacruel'
43 | }
44 | ]
45 | },
46 | {
47 | name: 'Electric',
48 | pokemons: [{
49 | level: '74',
50 | name: 'Pikachu'
51 | },
52 | {
53 | level: '34',
54 | name: 'Electabuzz'
55 | },
56 | {
57 | level: '88',
58 | name: 'Zapdos'
59 | }
60 | ]
61 | },
62 | ]
63 | }
64 |
--------------------------------------------------------------------------------
/homework/chapter16/static/.gitkeep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hootlex/the-majesty-of-vuejs/30bd16d6ccd51c26f2e120ac099469844a14bdb4/homework/chapter16/static/.gitkeep
--------------------------------------------------------------------------------
/homework/chapter2.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Greetings friend
5 |
6 |
7 |
8 |
Hello {{name}}
9 |
16 |
17 |
18 | {{ $data | json }}
19 |
20 |
21 |
22 |
31 |
--------------------------------------------------------------------------------
/homework/chapter3.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Greetings user
5 |
6 |
7 |
8 |
9 |
10 |
Hello,
11 |
12 | Mister {{name}}.
13 |
14 | Miss {{name}}.
15 |
16 |
17 |
18 |
So you can't decide. Fine!
19 |
20 |
21 |
22 |
23 |
24 |
25 | {{ $data | json }}
26 |
27 |
28 |
37 |
38 |
--------------------------------------------------------------------------------
/homework/chapter7.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Paint Me
5 |
6 |
7 |
8 |
9 |
10 |
Paint this background!
11 |
12 |
13 |
14 |
15 |
16 |
26 |
35 |
36 |
--------------------------------------------------------------------------------