Skip to content

Instantly share code, notes, and snippets.

Avatar
💭
Working on an example of dynamically loading Svelte components at run time

Razvan Predescu rzvdaniel

💭
Working on an example of dynamically loading Svelte components at run time
View GitHub Profile
@rzvdaniel
rzvdaniel / index.js
Last active May 27, 2020
Moleculer-Firebase index.js
View index.js
const functions = require('firebase-functions');
const { expressServer } = require('./server');
const moleculerApi = functions.https.onRequest(expressServer);
module.exports = {
moleculerApi
};
@rzvdaniel
rzvdaniel / server.js
Created May 27, 2020
Moleculer-Firebase server.js
View server.js
const { ServiceBroker } = require("moleculer");
const express = require('express');
const config = require('./moleculer.config');
const { PORT, NODE_ENV } = process.env;
const dev = NODE_ENV === 'development';
const broker = new ServiceBroker(config);
broker.loadServices("./services");
const svc = broker.getLocalService("api");
@rzvdaniel
rzvdaniel / .firebaserc
Created May 27, 2020
Moleculer-Firebase rc
View .firebaserc
{
"projects": {
"default": "moleculer-firebase"
},
"targets": {
"moleculer-firebase": {
"hosting": {
"api": [
"moleculer-firebase"
]
@rzvdaniel
rzvdaniel / firebase.json
Last active May 27, 2020
Moleculer-Firebase json configuration
View firebase.json
{
"hosting": [
{
"target": "api",
"public": "functions/public",
"ignore": [
"firebase.json",
"**/.*",
"**/node_modules/**"
],
@rzvdaniel
rzvdaniel / package.json
Last active May 27, 2020
Moleculer-Firebase package.json
View package.json
{
"name": "functions",
"version": "1.0.0",
"description": "My Moleculer-based microservices project",
"scripts": {
"dev": "moleculer-runner --repl --hot services/**/*.service.js",
"start": "moleculer-runner",
"cli": "moleculer connect ",
"ci": "jest --watch",
"test": "jest --coverage",
View Python launch.json VSCode
{
"version": "0.2.0",
"configurations": [
{
"name": "Python: Current File (Integrated Terminal)",
"type": "python",
"request": "launch",
"program": "${file}",
"console": "integratedTerminal"
},
@rzvdaniel
rzvdaniel / api.service.js
Created Jul 6, 2019
[Medium] Moleculer Routing - Shorthand RESTful Aliases
View api.service.js
const ApiGateway = require("moleculer-web");
module.exports = {
name: "api",
mixins: [ApiGateway],
settings: {
port: process.env.PORT || 3000,
routes: [{
@rzvdaniel
rzvdaniel / articles.service.js
Created Jul 6, 2019
[Medium] Moleculer Routing - RESTful Aliases
View articles.service.js
// articles.service.js
module.exports = {
name: "articles",
actions: {
list: {
handler(ctx) {
return "GET articles list";
}
},
@rzvdaniel
rzvdaniel / api.service.js
Created Jul 6, 2019
[Medium] Moleculer Routing - RESTful Aliases
View api.service.js
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 Jul 6, 2019
[Medium] Moleculer Routing - Auto Aliases
View users.service.js
// users.service.js
module.exports = {
name: "users",
actions: {
list: {
// Expose as "/users/"
rest: "GET /",
handler(ctx) {
return "GET Users list";
You can’t perform that action at this time.