Skip to content

Instantly share code, notes, and snippets.

View rzvdaniel's full-sized avatar

Razvan Predescu rzvdaniel

View GitHub Profile
@rzvdaniel
rzvdaniel / api.service.js
Created July 6, 2019 17:48
[Medium] Moleculer Routing - RESTful Aliases
const ApiGateway = require("moleculer-web");
module.exports = {
name: "api",
mixins: [ApiGateway],
settings: {
port: process.env.PORT || 3000,
routes: [{
@rzvdaniel
rzvdaniel / users.service.js
Last active July 6, 2019 17:37
[Medium] Moleculer Routing - Auto Aliases
// users.service.js
module.exports = {
name: "users",
actions: {
list: {
// Expose as "/users/"
rest: "GET /",
handler(ctx) {
return "GET Users list";
@rzvdaniel
rzvdaniel / api.service.js
Created July 6, 2019 17:25
[Medium] Moleculer Routing - Auto Aliases
const ApiGateway = require("moleculer-web");
module.exports = {
name: "api",
mixins: [ApiGateway],
settings: {
port: process.env.PORT || 3000,
routes: [{
@rzvdaniel
rzvdaniel / api.service.js
Last active July 6, 2019 17:14
[Medium] Moleculer Routing - Default Configuration
const ApiGateway = require("moleculer-web");
module.exports = {
name: "api",
mixins: [ApiGateway],
settings: {
port: process.env.PORT || 3000,
routes: [{
@rzvdaniel
rzvdaniel / greeter.service.js
Last active July 6, 2019 17:37
[Medium] Moleculer Routing - Default Configuration
// greeter.service.js
module.exports = {
name: "greeter",
/**
* Actions
*/
actions: {
/**
@rzvdaniel
rzvdaniel / greeter.service.js
Last active April 26, 2019 16:34
[Medium] Moleculer Mixins - A short introduction - greeter.service.js with Mixins
"use strict";
const WorldService = require("./world.service");
module.exports = {
name: "greeter",
mixins: [WorldService],
/**
* Actions
@rzvdaniel
rzvdaniel / world.service.js
Last active April 26, 2019 16:21
[Medium] Moleculer Mixins - A short introduction - world.service.js
"use strict";
module.exports = {
name: "world",
/**
* Actions
*/
actions: {
@rzvdaniel
rzvdaniel / greeter.service.js
Last active April 26, 2019 16:19
[Medium] Moleculer Mixins - A short introduction - greeter.service.js
"use strict";
module.exports = {
name: "greeter",
/**
* Actions
*/
actions: {
@rzvdaniel
rzvdaniel / SurroundWithBraces.snippet
Created March 25, 2019 11:22
Surround With Braces Visual Studio Snippet
<?xml version="1.0" encoding="utf-8" ?>
<CodeSnippets xmlns="http://schemas.microsoft.com/VisualStudio/2005/CodeSnippet">
<CodeSnippet Format="1.0.0">
<Header>
<Title>braces</Title>
<Shortcut>braces</Shortcut>
<Description>Code snippet to surround a block of code with braces</Description>
<Author>Igor Zevaka</Author>
<SnippetTypes>
<SnippetType>Expansion</SnippetType>
@rzvdaniel
rzvdaniel / JavascriptTimeOutExample.js
Created March 7, 2018 12:19
Javascript Timeout Example
setTimeout(() => {
// Anything here will be timed out for 2 seconds
}, 2000)