Commit 39a7056e authored by Laurent Wouters's avatar Laurent Wouters
Browse files

Fixed README

parent e72f8a70bb1b
# cubicweb-generic-client
## Run Project
## Build and run the project
```sh
npm install
npm start
# in another tab
npm run webpack
npm run serve
```
After you see the webpack compilation succeed (the `npm run webpack` step), open up `src/index.html` (**no server needed!**). Then modify whichever `.re` file in `src` and refresh the page to see the changes.
**For more elaborate ReasonReact examples**, please see https://github.com/reasonml-community/reason-react-example
The application is served by Webpack at [http://localhost:8080/](http://localhost:8080/).
## Build for Production
......@@ -23,3 +19,95 @@ npm run webpack:production
This will replace the development artifact `build/Index.js` for an optimized version.
**To enable dead code elimination**, change `bsconfig.json`'s `package-specs` `module` from `"commonjs"` to `"es6"`. Then re-run the above 2 commands. This will allow Webpack to remove unused code.
## Backend
For this application to work correctly, a backend CubicWeb instance must be running as follow:
* Create a Python `virtualenv` and activate it
* Install `cubicweb-jsonschema` from
`http://hg.logilab.org/master/cubicweb-jsonschema`, either by installing from
a local checkout or as:
```sh
pip install hg+http://hg.logilab.org/master/cubicweb-jsonschema#egg=cubicweb-jsonschema
```
* Get the source for the demonstration server by cloning `https://hg.logilab.org/review/react-jsonschema-ui`
* Install the `demo/server` package as `pip install [-e] demo/server` (this is actually a CubicWeb cube with a "bookstore" data model that we pull a recent CubicWeb version)
> Make sure you have a recent (>= 0.7.0) version of [wsgicors](https://pypi.python.org/pypi/wsgicors>), otherwise CORS settings documented below may not apply.
* Create an `jsonschema-demo` instance of the `bookstore` cube with a
`pyramid` configuration type (read subitems first!)
```sh
cubicweb-ctl create -c pyramid bookstore jsonschema-demo
```
* Pick sqlite as database backend (for demo only) or you may also use postgres if you've one configured. In the latter case you'll want to type additionaly:
```sh
pip install psycopg2
```
* In order to avoid any authorization issues, answer 'Yes' to the question "Allow anonymous access ?"
* Start the server with:
```sh
pserve <path to jsonschema-demo instance>/development.ini
```
* Try out (`pip install httpie` to get the `http` command):
```sh
http :6543/schema Accept:application/schema+json
```
You should get something like:
```http
HTTP/1.1 200 OK
Content-Length: 455
Content-Type: application/json
Date: Fri, 24 Mar 2017 08:23:50 GMT
Server: waitress
{
"links": [
{
"description": "List authors",
"href": "/author/",
"method": "GET",
"rel": "instances",
"targetSchema": {
"$ref": "/author/schema"
},
"title": "List"
},
{
"description": "List books",
"href": "/book/",
"method": "GET",
"rel": "instances",
"targetSchema": {
"$ref": "/book/schema"
},
"title": "List"
},
{
"description": "List topics",
"href": "/topic/",
"method": "GET",
"rel": "instances",
"targetSchema": {
"$ref": "/topic/schema"
},
"title": "List"
}
]
}
```
\ No newline at end of file
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment