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
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
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
src/main.ts
contains- global prefix (
/api
); - metadata for the OpenAPI 3.0 document;
- OpenAPI UI route (
/openapi
);
- global prefix (
src/auth/constants.ts
contains the secret string to sign/verify JWTssrc/app.module.ts
contains the full path for static files (SPA etc.)
To override the default port (8080) you can create an .env
file with a
line as follows:
PORT=8081
- Swagger UI →
http://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:
- NSwag: The Swagger/OpenAPI toolchain for .NET, ASP.NET Core and TypeScript
- ng-openapi-gen: An OpenAPI 3 code generator for Angular
- Author - Emanuele Aliberti
- Website - mtka.eu
- Matrix - mdaemon-dev
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.
node-mdaemon-rest
is MIT licensed.