valverdethiago / sensors-api

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

sensors-api

Description

This project aims to purpose a solution for sensor metadata REST API described here as a take home assingment for Backend Engineer at PingThings.

Solution

This software was written in go lang (version 1.19) and uses docker containers to spin up the development environment. Please make sure you have these software already set to be able to run it.

Dev Environment

To spin up the whole dev environment I created a docker-compose file with a postgres and a pgadmin instances to provide the capability to query database without needing to install any DB client. The postgres instance is populated with airport data, each line of the sensors table is populated with data from one airport. Thanks to Open Flights that provides airport and flights data in their website.

Starting instances

To run all the containers please execute:

make infra_up

Once the stack is up you can check the containers sunning

docker ps

You should see something similar to: Docker ps command

To run queries you can open pgamin using the credentials valverde.thiago@gmail.com/p1n6th1n65. To configure the connection between pgadmin and postgres use the following settings: PgAdmin Config

Running the server

Inside the root folder you can run the project using

go run main.go

or

make run

Endpoints

The following endpoints are available:

You can find a complete Postman collection with calls for all these endpoints here

Next steps

For the application to be considered production ready I would work in the following items:

  • Implement unit tests for at least the SensorService
  • Implement integration tests with test containers to test the whole end to end flow
  • Implement a search by name with pagination and sort
  • Create deployment manifest for k8s or any other container orchestration tool.

About


Languages

Language:Go 99.1%Language:Makefile 0.9%