Merge: nitweb: nitcorn based API to access model and source code
authorJean Privat <jean@pryen.org>
Tue, 15 Dec 2015 19:19:47 +0000 (14:19 -0500)
committerJean Privat <jean@pryen.org>
Tue, 15 Dec 2015 19:19:47 +0000 (14:19 -0500)
commit6725d2d0acb69d80778fbef3723a85b8559c44a4
tree9a9b05adf61aa84ab6ac39ad4e19556c72c74030
parentcd76d70ffaa84ad69bfb7f880f2039e5279fea98
parent11fbbb17bb8a65df87f2ee20fc4191a6626f1663
Merge: nitweb: nitcorn based API to access model and source code

Description from man page:

# NAME

nitweb - provide a web API to nit model and source code.

# SYNOPSIS

nitweb [*options*] FILE...

# DESCRIPTION

`nitweb` use `nitcorn` actions to provide an API to loaded model and source code.

Usage:

~~~sh
nitweb --host localhost --port 3000 lib/core/
~~~

### `GET /` HOME
Show the home page of the webserver.
Display all the loaded model entities in a tree.

### `GET /search/:namespace` SEARCH BY NAMESPACE
Search all model entities matching `namespace`.

It is possible to retrieve the result as a JsonArray instead of raw html
using the uri param `json=true` (default `false`).

### `GET /code/:namespace` SHOW SOURCE CODE
Display the source code of the entity matching `namespace`.

### `GET /doc/:namespace` DOCUMENTATION PAGE
Display a short documentation page about the entity matching `namespace`.

### `GET /random/` RANDOM LIST
Display a random list of entities found in the model.

The list is parametrable with the following uri params:
* `n=10` size of the list (default `10`)
* `k=modules` kind of entities in the list (default `modules`)

It is possible to retrieve the result as a JsonArray instead of raw html
using the uri param `json=true` (default `false`).

# OPTIONS

### `--host`
The host to bind the web server on.

### `--port`
Port number to use

### `-h`, `-?`, `--help`
Show Help (the list of options).

Pull-Request: #1889
Reviewed-by: Jean Privat <jean@pryen.org>