Wildhoney / Magento-on-Angular

Angular.js application using Magento as the backend API
361 stars 120 forks source link

Moa

Note: Those updating from 0.2.8 to 0.3.0 need to run: composer dump-autoload from api/ and update the new config.json file.

Tired of Magento's lack of unit testing? Configuration over convention? Use of Prototype.js? Badly written JavaScript? Untested third-party modules? Likewise! Moa brings Magento into the 21st century.

Angular, Magento, Laravel

Heapshots: Moa uses HeapDump to take memory snapshots. Send a kill -USR2 <pid> where <pid> is your Node.js process ID.

Getting Started

Optionally, you may prefer to structure your config and folders in the manner described in this wiki page: https://github.com/Wildhoney/Magento-on-Angular/wiki/Preferred-Folder-Structure-and-Config

If things are not working correctly, take a look at api/public/attributes/color for any Laravel/Magento issues. Please don't spend too much time debugging – file a bug!

Unit Testing

All unit tests for both JavaScript and PHP can be run from the terminal: grunt test.

Generating Products

Since your product collection might be a little slow because of Magento's EAV database structure, Moa allows you to create a cache key via the terminal instead – however a cached copy will still be generated if you access it via your browser.

In order to generate a cache for the product collection, you can run php artisan products from the terminal. Once completed, the normal API method via the browser will use this cache key.

Redis

Please note that by default the cache is using plain old file cache. If you want to use Redis, change the configuration on line 18 of api/app/config/cache.php from file to redis. More information on the cache configuration is available on http://laravel.com/docs/cache#configuration.

Directory Structure

At first glance the directories may seem over-complicated. However there's method in all of the madness!

Laravel API

If you prefer to use another JS framework such as Ember or Meteor, then you're more than welcome to use the API in isolation. Below we've documented the URLs and their purposes:

Specification