Adding endpoint to lora-app-server api

hello!
I am trying modify lora-app-server to add new endpoint.
For that:

  1. created message.proto custom proto in api folder
  2. this proto file added to api/gen.sh
  3. then it compiled by $ make api which generates api/message.pb.go, api/message.pb.gw.go and api/swagger/message.swagger.json
  4. internal/api/external/message.go implemented as well as internal/storage/message.go
  5. js files of ui modified to call endpoint /api/messages registered in api/message.proto file.
  6. new server registered:
    api.RegisterMessageServiceServer(grpcServer, NewMessageAPI(validator))
    in setupAPI() function of internal/api/external/external.go file.

So when I open web interface of lora-app-server I see that request for url http://localhost:8078/api/messages?limit=10&applicationID=1
returns 404 and no log messages of backend at all.

Along with 404 error I get following error message:

Screenshot%20from%202019-12-22%2014-54-49
When I add this endpoint to existing proto file everything works as expected. But no luck in separate proto file. Did I miss something?

I want to implement custom endpoints using separate proto file to stay compatible with feature updates of lora-App-Server.

I’ve been trying to do something similar, and I’ve got stuck as well. I was wondering if you ever managed to make it work?

I’ve tried to add an endpoint that would read data from the postgresql integration tables.

I’ve been working with the latest version chirpstack-api and chirpstack-application-server, so some of the steps are slightly different from yours.

I’ve cloned the latest chirpstack-api added my .proto files for my additional endpoints, used make to generate the others, as you did.

In addition to what you did, I’ve modified the Makefile of chirpstack-application-server to use my local modfied chirpstack-api project.

I’ve also created my chirpstack-application-server files under internal/storage and internal/api/as/external.

However when I compile the chirpstack-application-server I get a few errors when it gets to the internal/api/external .go files:

go build -a -installsuffix cgo -ldflags “-s -w -X main.version=” -o build/chirpstack-application-server cmd/chirpstack-application-server/main.go
# github.com/brocaar/chirpstack-application-server/internal/api/external
internal/api/external/device_up.go:28:54: undefined: api.ListDeviceUpRequest
internal/api/external/device_up.go:28:80: undefined: api.ListDeviceUpResponse
internal/api/external/device_up.go:50:10: undefined: api.DeviceUpListItem
internal/api/external/external.go:91:2: undefined: api.RegisterDeviceUpServiceServer
make: *** [Makefile:8: build] Error 2

I can’t figure out what I’m missing. Anyone managed to find a solution to this?