Giter Site home page Giter Site logo

greenicoapi's Introduction

Greenico API

Weather station with Raspberry Pi Pico - "Greenico"

GreenicoAPI is only a part of Greenico project.

The first part is Greenico on Raspberry Pi Pico. Be sure to check it out also.

Table of contents

  1. The purpose of the project
  2. Description
  3. Technical information
  4. Contact

Purpose

The aim of the project is to allow the user to view the current state of the weather by designing and building a weather station. The preview will be possible through a browser, i.e. a web application in the form of clear graphs and on the display attached to the weather station.

Description

Go was chosen as the programming language for this part of the project with Gin framework due to the ease of implementing the RESTful API and the simplicity of connecting the application with Postgres database. The web application was built using Go templates and language JavaScript. The Postgres database was created using the Soda migration tool.

Available endpoints

API endpoints:

// API
router.GET("/api/reading", handlers.GetReading(db))
router.GET("/api/readings", handlers.GetReadings(db))
router.GET("/api/all-readings", handlers.GetAllReadings(db))
router.POST("/api/reading", handlers.InsertReading(db))
router.DELETE("/api/reading", handlers.DeleteReading(db))

Web application endpoints:

// WEB APP
router.GET("/", handlers.MainRender(db))
router.GET("/voc", handlers.PageRender(db, "voc"))
router.GET("/temperature", handlers.PageRender(db, "temperature"))
router.GET("/humidity", handlers.PageRender(db, "humidity"))
router.GET("/light", handlers.PageRender(db, "light"))
router.GET("/pressure", handlers.PageRender(db, "pressure"))
router.GET("/uv", handlers.PageRender(db, "uv"))

Technical

API was written in Go programming language with the use of Gin framework. All requirements are listed in go.mod file.

How to run the app

  1. Create (in the root directory of the project) and fill values in .env file:
HOSTNAME=
PORT=
DBNAME=
DBUSER=
DB_PASSWD=
  1. Run run.bat file

Contact

Contact me at: [email protected]

greenicoapi's People

Contributors

anras5 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.