
Security News
RubyGems Adds Cooldown Feature to Bundler for Newly Published Gems
RubyGems and Bundler 4.0.13 introduced an opt-in cooldown feature that delays newly published gems during dependency resolution.
methodulus
Advanced tools
npm i -S methodulus
This example creats a rest (express based) server using a controller class
Playerit is configured to run the class code locally via an http server.
import { Player } from './controllers/player';
import { ServerType, Server, MethodulusConfig, MethodulusClassConfig, MethodType } from 'methodulus';
async function init(){
let config = new MethodulusConfig();
config.run(ServerType.express, {port: process.env.PORT });
config.use(Player, MethodType.Local, 'http://127.0.0.1:8090')
const server = await new Server(process.env.PORT || 8020).configure(config).start();
}
init();
import { Body, Method, MethodConfig, MethodType, Param, Query, Verbs, MethodError, MethodResult } from 'methodulus';
import { PlayerModel } from '../models/player';
@MethodConfig('Player')
export class Player {
@Method(Verbs.Post, '/api/player')
public async create() {
let p = new PlayerModel('1', 'player 1');
await DB.Player.insert(p);
return new MethodResult(p)
}
@Method(Verbs.Get, '/api/player/:player_id')
public async read( @Param('player_id') playerId: number) {
return await DB.Player.find({ 'Id': playerId });
}
@Method(Verbs.Put, '/api/player')
public async update() {
}
@Method(Verbs.Delete, '/api/player')
public delete() {
}
}
configuration must complete before the server starts. configure each controller class to its desired state
let config = new MethodulusConfig()
the run method determines what kind of server to run on the listening part of the application. to listen to REST request you should run ServerType.Expess and to listen to redis channel use ServerType.Redis .
ExpressRedisMQSocketthe use method registers the way a class should be activated. the first parameter is a class decorated with methodulus decoratos.
avaliable options are
Local | Http | MQ | Socket | Redis
Local
run the code in the class, no proxy or transport required.
Http
run the code using an http request to a microservice.
MQ
use amqp rpc to execute the class code
Socket
directly connect to a server using websocket connection.
Redis
use redis rpc to execute the class code
in order to access the correct service methodulus uses a resolver, which may be a literal containing the service uri or a promise returning the same.
resolvers are attached to a class, allowing the application to use different resolvers for different services.
ServerType.express, {port: process.env.PORT }
an instamce of methodulus can run multiple listeners in different channels. the current list is:
expresssocketioamqpredishere is a simple local configuration:
let servers = ['express'];
let config = new MethodulusConfig(servers);
let resolver = 'http://127.0.0.1:8090';
config.use(TestClass, MethodType.Local,resolver);
The class
Playerto run locally.
creates an agnostic configured server.
const server = new Server(process.env.PORT);
Server methods are chainable and should e called in this order
const server = await new Server(process.env.PORT).configure(config).start();
FAQs
Unknown package
The npm package methodulus receives a total of 15 weekly downloads. As such, methodulus popularity was classified as not popular.
We found that methodulus demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
RubyGems and Bundler 4.0.13 introduced an opt-in cooldown feature that delays newly published gems during dependency resolution.

Security News
pnpm 11.5 now recognizes npm staged publish approvals in release metadata, preventing those releases from being mistaken for lower-trust package publishes.

Security News
Federal audit finds NIST lacked a plan to clear the NVD backlog, wasted funds on duplicate work, and delayed use of CISA data.