The official REST API for alain
Get magical product names from this convoluted simple REST API!
Public API can be found at http://alainasaservice.com
The API is versioned by URL. Currently there's only one version, and it's a bit odd awesome.
JSON is the default medium, but content negotiation will may work.
Get some product names!
Returns an array of strings by default, but the response structure changes based on the request.
-
e
,exactly
: integerGenerate exactly this many product names. If a value of
1
is given, the response structure will be a single string or object (seeobject
param below) instead of an array.¯\_(ツ)_/¯
-
n
,min
: integerGenerate at least this many product names.
-
x
,max
: integerGenerate at most this many product names.
-
j
,join
: stringJoin the array of generated product names into a single string using this value as the delimiter. Response structure will be a string.
-
o
,object
: anyIf any truthy value is given, returns an object for each product name instead of a string. Product name objects will have a
left
andright
property. Ifexactly=1
is also given, the response structure will be a single object instead of an array of objects.
Currently redirects to /v1
.
Requires Node 4+. Clone this repo and install dependencies with npm i
.
Run and stop the server in the foreground with npm start
and ctrl+c.
Run and stop the server in the background with npm run forever
and npm run halt
.
Binds to port 8080.
"Application" logging goes to stdout and is unstructured.
"Audit" logging goes to log/audit.log
(with file rotation) and is JSON. You could use hewer
to aggregate metrics from this log.
ISC © Contributors