Skip to content

simple rest api and web serveur for the CESI IoT CUBE

Notifications You must be signed in to change notification settings

celian-hamon/CUBEIOT

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation


CUBE IOT

This is a repository about the IOT CUBE a project wich aim to make an autonomous meteorological arduino station with an api a database and a Frontend

Backend :

Summary :

The backend is composed by a REST API wich is made with Python3 and Flask
It is splitted in 3 sections :

  • Probe
  • User
  • Data
Probe and User parts are CRUD and Data part is just CRD because you dont need to modify the data sent by the probe

A test suite is available for the whole API, it is built with the package request and test each endpoint of the api

The users password are encrypted with the pbkdf2_hmac algorythm wich iterate 100k time the sha256 on the password, then both the salt generated by the os and the password are stored in the database, this ensure that nobody can see the password and in case the db is leaked the passwords are safe

A postman suite is built to help test the api during devlopment

Deployement :

1. Deploy the database :

$ mysql -u <username> -p <database_name> < create-database.sql

2. Run the virtual env installation script:

$ sudo chmod 600 install-venv.sh
$ ./install-venv.sh

3. Activate venv, Set venv variables and run the server

$ source venv/bin/activate
$ export FLASK_APP=main

4. Modify the config file with your databases credentials in backend/config.json

{
    "host": "localhost",
    "user": "root",
    "password": "root",
    "database": "cube"
}

That's it you now have a working backend api

Frontend :

Summary :

The Frontend is composed of a simple http server in golang and a bunch of html pages

For convenience the web pages are built around purged bootstrap

Deployement :

1. Build a binary :

$ go build .

2. Run the binary :

$ sudo chmod 600 frontend
$ ./frontend

Collaborators :

  • Célian HAMON : Backend server in flask, Frontend server in Golang, Raspberry setup and programmation, database, test suite and postman suite, documentation, github workflows
  • Clément Lessieur : Frontend and Backend
  • Kévin Moraiville : Frontend and Backend

Repository stats :

Readme Card