You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{"endpoints":[{"url":"/api/contents","description":"Return all the contents"},{"url":"/api/contents/:id","description":"Return the given contents"},{"url":"/api/tags","description":"Return all the tags"},{"url":"/api/tags/:id","description":"Return the given tags"},{"url":"/api/authors","description":"Return all the authors"},{"url":"/api/authors/:id","description":"Return the given authors"},{"url":"/api/albums","description":"Return all the albums"},{"url":"/api/albums/:id","description":"Return the given albums"},{"url":"/api/titles","description":"Return all the titles"},{"url":"/api/titles/:id","description":"Return the given titles"},{"url":"/api/","description":"Return all items"},{"url":"/api/random","description":"A random item"}]}%
52
+
```
21
53
22
54
## Usage
23
55
24
56
```js
25
-
var apiize =require('apiize');
57
+
const Apiize = require('apiize');
58
+
59
+
// Here is the default options
60
+
const options = {
61
+
verbose: false, // Output more verbose requests
62
+
prefix: 'api', // The root endpoint of the API
63
+
port: 1313 // The express server port.
64
+
};
65
+
66
+
// Turn the 'http://example.org/file.json' file into an API
67
+
let apiize = new Apiize('http://example.org/file.json', options);
68
+
69
+
// When apiize is ready
70
+
apiize.on('ready', function (server) {
71
+
server.serve(); // run the server
72
+
});
73
+
74
+
```
75
+
76
+
## API
77
+
78
+
```js
79
+
var Apiize = require('apiize');
26
80
27
-
apiize('Rainbow');
81
+
var api = new Apiize(link, options);
28
82
```
29
83
84
+
### Apiize(link, options)
85
+
86
+
Create a new Apiize object using the given `link` and `options`.
87
+
The `link` argument must be a string of a JSON file or a JSON URL.
88
+
89
+
#### Options
90
+
91
+
Apiize accepts these properties in the options object.
92
+
93
+
##### verbose
94
+
95
+
Defaults to `false`, add a more verbose logging of incoming requests.
0 commit comments