Skip to content

Proof of concept for a RESTful API server for MDaemon.

License

Notifications You must be signed in to change notification settings

ealib/node-mdaemon-rest

Repository files navigation

node-mdaemon-rest

GitHub issues Matrix

Description

Proof of concept for a RESTful API server for MDaemon.

---
title Architecture
---
flowchart TD
    nmr((node-mdaemon-rest))
    node{{Node.js}}
    nma((node-mdaemon-api))
    md[/MDaemon/]

    nmr<-- interpreted -->node
    node<-- native module -->nma
    nma<-- native APIs -->md

    style nmr fill:#eee
    style node fill:#0f0
    style nma fill:#ff0
    style md fill:#f00
Loading

Installation

REM clone source repository
C:\Users\UserName> git clone https://github.com/ealib/node-mdaemon-rest.git

REM enter local source repository
C:\Users\UserName> cd node-mdaemon-rest

REM install dependencies
C:\Users\UserName\node-mdaemon-rest> yarn install

Running the server

REM development
C:\Users\UserName\node-mdaemon-rest> yarn run start

REM watch mode
C:\Users\UserName\node-mdaemon-rest> yarn run start:dev

REM production mode
C:\Users\UserName\node-mdaemon-rest> yarn run start:prod

Customisation

Code

  • src/main.ts contains
    • global prefix (/api);
    • metadata for the OpenAPI 3.0 document;
    • OpenAPI UI route (/openapi);
  • src/auth/constants.ts contains the secret string to sign/verify JWTs
  • src/app.module.ts contains the full path for static files (SPA etc.)

.env

To override the default port (8080) you can create an .env file with a line as follows:

PORT=8081

Useful links

  • Swagger UIhttp://localhost:8080/openapi
  • OpenAPI 3.0 JSON API document → http://localhost:8080/openapi-json
  • OpenAPI 3.0 YAML API document → http://localhost:8080/openapi-yaml

OpenAPI document can be fed in to the generator to create proxy code to easily call the MDaemon APIs from your application.

See also other custom generators:

Stay in touch

Legal disclaimer

MDaemon® is a trademark of MDaemon Technologies, Ltd. MDaemon Technologies makes no representations, endorsements, or warranties regarding Third Party Products or Services. Read more in their Legal Notice.

Node.js is a trademark of OpenJS Foundation.

Windows™ is a trademark of Microsoft Corp.

License

node-mdaemon-rest is MIT licensed.

About

Proof of concept for a RESTful API server for MDaemon.

Resources

License

Stars

Watchers

Forks

Packages

No packages published