It supports using MongoDB at development & production and using NeDB at unit testing.
- use NeDB memory DB for unit testing (
NODE_ENV=test
). - use NeDB file storage if
NEDB_FOLDER
is defined. - use other empty MongoDB database for E2E testing (
NODE_ENV=test TEST_E2E=true
). - create collection indexes.
- generate entity changed broker messages. E.g.
posts.entity.created
,posts.entity.updated
,posts.entity.removed
This mixin created two methods to encode & decode your IDs in order to be more secure. Read more about it in hashids.js readme. It generates a Youtube-like ID from Number IDs or Mongo ObjectID.
Please note, you should define a salt for HashID with
HASHID_SALT
environment variables.
const SecureID = require("../mixins/secure-id.mixin");
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"use strict"; | |
const _ = require("lodash"); | |
const chalk = require("chalk"); | |
const Promise = require("bluebird"); | |
const ServiceBroker = require("../src/service-broker"); | |
const { MoleculerError } = require("../src/errors"); | |
// --- SAGA MIDDLEWARE --- | |
const SagaMiddleware = function() { |
Use it for Kubernetes liveness & readiness checks. The middleware opens a HTTP server on port 3001. To check, open the http://localhost:3001/live & http://localhost:3001/ready URL.
{
"state": "up",
"uptime": 7.419,
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'use strict'; | |
const path = require('path'); | |
const fs = require('fs'); | |
const YAML = require('yaml'); | |
function WebpackMoleculerServicePlugin(options) { | |
options = options || {}; | |
if (typeof options === 'string') { | |
this.options = { output: options }; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Install K3S | |
curl -sfL https://get.k3s.io | sh - | |
# Copy k3s config | |
mkdir $HOME/.kube | |
sudo cp /etc/rancher/k3s/k3s.yaml $HOME/.kube/config | |
sudo chmod 644 $HOME/.kube/config | |
# Check K3S | |
kubectl get pods -n kube-system |