iot-logger

command module
v0.0.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 13, 2021 License: MIT Imports: 7 Imported by: 0

README

IoT Logger

This is a very basic, graphql based data logger server, designed to be used for IoT devices which cannot be debugged via serial, written in Go.

Installation

go install github.com/llamadeus/iot-logger@latest

Configuration

cp .env.example .env

Then edit .env and adjust it as desired.

Alternatively, you can provide the variables defined in .env.example via standard environment variables.

Running the server

go run main.go

If APP_ENV is set to development you can test the server in your browser. Just visit http://localhost:8080/graphql and try one of the following queries and mutations.

Schema

The server provides a graphql endpoint with the following schema:

scalar Time

type Message {
    id: ID!
    text: String!
    timestamp: Time!
}

type Query {
    # Send a ping to the server.
    # She will reply with a "pong".
    ping: String!
}

type Mutation {
    # Add the given message to a channel.
    # If the mutation returns true you know that
    # at least one subscriber received the message.
    addMessage(channel: String!, message: String!): Boolean!
}

type Subscription {
    # Listens for messages in the given channel.
    messageAdded(channel: String!): Message!
}

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis
features
channels
This package contains the code implementing the queries, mutations and subscriptions defined in logger.graphql.
This package contains the code implementing the queries, mutations and subscriptions defined in logger.graphql.
internal

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL