In order to compare a couple Javascript MVC libs, I wanted to get a small REST server running to persist some data to. I saw Silex before, and figured to just use that.
(Note in the below examples, I’m using composer in an globally installed environment.)
$ mkdir rest $ cd rest $ vi composer.json
The contents of the composer.json file (per intro on http://silex.sensiolabs.org/download)
{
"require": {
"silex/silex": "1.0.*"
},
"minimum-stability": "dev"
}
$ composer install $ mkdir web $ cd web $ vi index.php
The contents of index.php are per the http://silex.sensiolabs.org/doc/usage.html#bootstrap example.
// web/index.php require_once __DIR__.'/../vendor/autoload.php'; $app = new Silex\Application(); // definitions $app->run();
Thats it! We have a sandbox to start building out more routes to handle the RESTful calls.