Skip to content

How to run this app?

Jim edited this page Feb 24, 2017 · 4 revisions

Docker Demo

This repository includes a docker-compose file that makes it super easy to demo the application.

  1. Install Docker (Check the internet for help on that one)
  2. Clone the repo and from inside it run
docker-compose up;

...then visit localhost:8080

You should see something like this:

me@my-computer:/REPO-DIRECTORY/$ docker-compose up
Starting phalconjsonapi_php_1
Starting phalconjsonapi_web_1
Attaching to phalconjsonapi_php_1, phalconjsonapi_web_1
php_1 | *** Running /etc/my_init.d/00_regen_ssh_host_keys.sh...
php_1 | *** Running /etc/rc.local...
.....

Manual Installation

This is a more time consuming option, but might be preferred if you already have a working Phalcon installation.

Requirements

  1. Install Phalcon on your webserver. You installed a webserver with PHP 7 right?

  2. Make sure Composer is installed

  3. This demo application uses an sqlite database for persistent storage. Make sure that PDO support for sqlite is installed.

something like...

sudo apt-get install php7-sqlite;

###Install the application These instructions skip some server specific factors and assumes you are installing this application to the root directory of your webserver.

  1. Download this project files to your local web server.
git clone https://github.com/gte451f/phalcon-json-api.git
  1. Run the following from inside your newly installed application:
composer install;
  1. Setup your webserver for Phalcon usage. See here for Apache and here for Nginx

###To test:

Vist your application and you should see something like this:

{"GET":
    ["\/v1\/addresses",
    "\/v1\/addresses\/{id:[0-9]+}",
    "\/v1\/customers",
    "\/v1\/customers\/{id:[0-9]+}",
    "\/v1\/users",
    ...

Try out different end points like: /v1/addresses

{	"addresses": [
	{
    	"user_id": "15",
    	"id": "1",
    	"street": "123 Easy Street",
    	"state": "Oregon",
    	"zip": "24901",
    	"city": "Eugene"
	}....
Clone this wiki locally