Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • Nov 18 2021 08:22
    slaterx review_requested #94
  • Nov 18 2021 08:22
    slaterx commented #94
  • Nov 18 2021 08:04

    slaterx on go_modules

    (compare)

  • Nov 18 2021 08:04

    slaterx on develop

    Bump github.com/tidwall/gjson f… Switching to docker for reenabl… Added kafka service to drone and 5 more (compare)

  • Nov 18 2021 08:04
    slaterx closed #95
  • Nov 18 2021 08:02
    codecov[bot] commented #95
  • Nov 18 2021 08:01
    slaterx synchronize #95
  • Nov 18 2021 08:01

    slaterx on go_modules

    Update .drone.yml (compare)

  • Nov 18 2021 07:41
    slaterx synchronize #95
  • Nov 18 2021 07:41

    slaterx on go_modules

    Update .drone.yml (compare)

  • Nov 18 2021 07:40
    slaterx synchronize #95
  • Nov 18 2021 07:40

    slaterx on go_modules

    Update .drone.yml (compare)

  • Nov 18 2021 07:39
    slaterx synchronize #95
  • Nov 18 2021 07:39

    slaterx on go_modules

    Adding wait for kafka command (compare)

  • Nov 18 2021 07:15
    slaterx synchronize #95
  • Nov 18 2021 07:15

    slaterx on go_modules

    Added kafka service to drone (compare)

  • Nov 18 2021 03:40
    slaterx synchronize #95
  • Nov 18 2021 03:40

    slaterx on go_modules

    Switching to docker for reenabl… (compare)

  • Nov 18 2021 03:38
    dependabot[bot] labeled #95
  • Nov 18 2021 03:38
    dependabot[bot] opened #95
const result = await postRequest("/api/chat/sendMessage", {
contactId: contact.id,
deviceToken,
message,
target,
individual
});
see that this action.. returns a simple map
return map[string]interface{}{
"result": "message sent",
}
which to the web front end .. the response will be an application/json -> {result:"message sent"}
so.... const result = {result:"message sent"}
that answer your question?let me know if u have issues trying to run the whatsapp app example.
Johnlery
@jtinio
Hi Rafael, Thank you for your quick response

package main

import (
"fmt"

"github.com/moleculer-go/gateway"
"github.com/moleculer-go/moleculer"
"github.com/moleculer-go/moleculer/broker"
"github.com/moleculer-go/moleculer/cli"
"github.com/spf13/cobra"

)

type JS struct {
A int json:"awfnieanifnei"
B int json:"wwdfwf"
}

type IMathService interface {
Name() string
Add(params moleculer.Payload) JS
Sub(a int, b int) int
Inc(a int)
}

type MathService struct {
}

func (s *MathService) Name() string {
return "math"
}

func (s MathService) Add(ctx moleculer.Context, params moleculer.Payload) JS {
ctx.Meta.http.resp.
av := params.Get("a").Int()
bv := params.Get("b").Int()
return JS{A: av, B: bv}
}
func (s
MathService) Sub(a int, b int) int {
return a - b
}

// ⭐ You can also have an action that receive no parameters ⭐
func (s *MathService) Inc(a int) {
//do magic!
fmt.Println("action passed! ", a)
}

func main() {

mathSvc := &MathService{}
gatewaySvc := &gateway.HttpService{
    Settings: map[string]interface{}{"port": "9015"},
}

cli.Start(
    &moleculer.Config{LogLevel: "info"},
    func(broker *broker.ServiceBroker, cmd *cobra.Command) {
        broker.Publish(gatewaySvc, mathSvc)
        broker.Start()
    })

}

Here's my test code
image.png
image.png
Here;'s the postman test
and I was successfully get the json data but it's not application/json
image.png
It's a text/plain
Rafael Almeida
@pentateu
yeah.., that was a bug :) .. I have just pushed the fix to the gateway.. in your go modules make sure you have:
v0.0.1 has the fix ..
also.. you don't need to create this JS struct.. with anotations.. your action just need to return a map[string]interface{} .. and moleculer will serialize in JSON..
no problem doing. the way u did.. it is just that with maps.. or simple objects is more simple.. and moleculer goal.. is to make development simple and flexible.
I also updated the README of this example.. on how to run it :)
Johnlery
@jtinio
Awesome! Thank you for your help! I'll make sure to checkout that whatapp app example that you created. Cheers!
casskir
@casskir
Hi Rafael, Can you check this PR moleculer-go/goemitter#2 ? Some problems with locks =)
Gleidson Nascimento
@slaterx
thanks for the PR @casskir, we will check it and comment on it
just odd that I can’t see the CI info on the PR…
casskir
@casskir
CI not configured for this project
Gleidson Nascimento
@slaterx
oh, okay
let me retry one of the failing jobs, then
Actually, we need to accept the PR first before we can retest the failed jobs...
let’s wait for @pentateu’s feedback :)
casskir
@casskir
Failed tests not fixed yet. I still work on it =)
Brandon Slinkard
@slinkardbrandon
Hey everyone! Just found this room on the GitHub for moleculer-go. Wanted to reach out and see if there were any simple things I could do to help out the initiative. I’m very new to Go but am trying to learn, on the other hand, I’m familiar with a decent chunk of moleculer JS. Was hoping this would be a decent place to start for applying my golang tutorials & research to a real project. Ha!
I also see @casskir said that CI is not configured for the project, is that for all of moleculer go or just the emitter? I’ve set up loads of CI and can definitely do my best to help out there too.
Gleidson Nascimento
@slaterx
@slinkardbrandon hi and welcome! One of the things we are aiming here is to make the roadmap more visible so volunteers can easily pick up tasks. Specifically for the comment made by @casskir, it’s about a PR he created for adding AMQ support. But, please, at this point, feel free to play with moleculer and propose any update/enhancement you see across the platform!
casskir
@casskir
@slinkardbrandon CI configured for the moleculer-go main repository (Drone CI), bu not configured for the emitter repo.
As I understand travis also configured for moleculer-go repo, but not supported now (all latest builds are failed).
I waiting while emitter will be checked and merged for fixing amqp tests in the moleculer-go.
Gleidson Nascimento
@slaterx
@casskir Is this the only thing you’re waiting now?
casskir
@casskir
@slaterx yes. I can't use events for the 'bad' tests because they hang (all goroutines sleep).
Rafael Almeida
@pentateu
Hi @casskir I provided feedback in the PR.
Hi @slinkardbrandon welcome
one place we need help is with writing example apps and documentation
as u learn.. you could help converting the docs.. we forked the moleculer js docs.. to give us a head start.. since we can reuse the structure and a good chunk of it (concepts an etc) an re-write all the language specific bits.
that is the repo for the docs
you can do PRs.. and once approved the CI will deploy directly to the heroku app that hosts the docs.. Docs URL here: http://gomicro.services
Rafael Almeida
@pentateu
as for writing example applications.. would be good to have a simple webapp that used the modules https://github.com/moleculer-go/gateway https://github.com/moleculer-go/store https://github.com/moleculer-go/cqrs