0.9.1 • Published 3 years ago
didinium v0.9.1
didinium
The frivolous API front-end 😂
Setup
Create didinium.yaml at the top level of your Node.js project and write the following.
port: 3000
interfaces:
- contextPath: "example"
interface: "./open-api.yaml"
route: "./route.yaml"
authentication:
module: "./authentication.js"
function: "authenticate"
authorization:
module: "./authorization.js"
function: "authorize"open-api.yamlis the OpenAPI definition file in your Node.js project.- At least OAuth2 clientCredentials must be defined in
components.securitySchemes.
- At least OAuth2 clientCredentials must be defined in
route.yamlassociates the request URL with the JS module in your Node.js project.authentication.jsis the OAuth authentication implementation in your Node.js project.authenticateis a function ofauthentication.jsand is the logic that performs authentication.authorization.jsis the OAuth authorization implementation in your Node.js project.authorizeis a function ofauthorization.jsand is the logic that performs authorization.
route.yaml is defined as follows.
/users:
GET:
module: ./logic/users.js
function: getUsers
POST:
module: ./logic/users.js
function: addUserFinally, npm install didinium in your Node.js project and npx didinium will start the API server on the specified port.