/wordpress-restapi-angular2

Wordpress on the back, angular 2 on the front and REST API to glue them together

Primary LanguagePHP

Wordpress reastapi Angular (>2)

🔥 Important!

👉 I'm rewriting this app ground up.

⏳ Previous solution is stored in different branch: v.1.0

Installation dev environment

Notice that I haven't tested it in windows, therefore it could be a problems. That said feel free to create a PR if you have good fix.

I'm using dockie/lamp

  1. Get last image.

    $ docker pull dockie/lamp
    
  2. Install container.

    $ docker run -d -p 8000:80 -p 2200:22 -p 3306:3306 -v $(pwd)/www:/var/www/html:rw dockie/lamp
    

    Site will be available at http://localhost:8000/

  3. Adding wordpress bd - http://localhost:8000/phpmyadmin

  4. Copy last wordpress CMS to www folder.

  5. Create wp-config.php. For development environment settings will be:

    define('DB_NAME', 'wordpress');
    define('DB_USER', 'root');
    define('DB_PASSWORD', 'root');
    define('DB_HOST', 'localhost');
    define('DB_CHARSET', 'utf8');
    define('DB_COLLATE', '');
  6. Install packages and build js and css

    $ npm i && npm run build
    
  7. Activate theme.

  8. Install plugins (message will appear in dashboard after theme will be active).

  9. Activate permalinks of type "Post name".

Now you should be able to use rest-api, for example to get all posts use link: http://localhost:8000/wp-json/wp/v2/posts

Documentation for wp rest api

Frontend stack

CMS

Backend stack

MySQL

Connect on localhost:3306, user root, password root.

Useful links

starter for Angular v2+ using Webpack Angular 2 — Introduction to Redux ngrx/store