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.
Heapshots: Moa uses HeapDump to take memory snapshots. Send a kill -USR2 <pid>
where <pid>
is your Node.js process ID.
npm install
, bower install
;composer install
from api/
;config.json
file.config.json.sample
with your own paths, and hostnames; rename config.json.sample
to config.json
grunt
php artisan products
from api/
;node node/server.js
;example.com/Magento-on-Angular/store/
in your browser;base_url
in Magento Admin > Configuration > Web
if you did a fresh installation of Magento.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!
All unit tests for both JavaScript and PHP can be run from the terminal: grunt test
.
grunt php-test
grunt js-test
phpunit
command from the /api/
directory;/store/tests/
;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.
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.
At first glance the directories may seem over-complicated. However there's method in all of the madness!
api
contains the Laravel framework which interfaces with Magento;dist
contains production-ready minified JS/CSS files for Moa;node
contains Node.js server for delivering products via Snapshot;store
contains the actual Angular.js Moa application;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:
/products
– fetch all the products;/product/5
– fetch a product with the ID of 5;/categories
– fetch all the categories and their sub-categories;/basket
– fetch all of the items in the basket;/basket/add/2/4
– add an item to the basket with product ID 2 and quantity 4;/basket/remove/2
– Remove an item from the basket;/attributes/color
– fetch attributes by name;/currencies
– fetch a list of currencies and their conversion rates;/account
– fetch details of currently logged in user;/account/login
– login a user;/account/logout
– logout a user;/account/register
– create a new user account;