Git Product home page Git Product logo

weather_station_server's Introduction

Weather station server app

Weather Station API

Maintainability

Test Coverage

Build Status

A simple Node.js/Express app receiving data from a Raspberry Pi weather station and making it available via API request from other sources. This app is part of our final project, a separate app was written to create a Single Page App that utilises the API server and displays the weather data.

Go here to see the live SPA App

Repo for SP App

Technologies

  • Javascript linted with eslint
  • express
  • mocha + nyc test Coverage
  • mongodb with mongoose
  • deployed to heroku via Travis CI/CD

Instructions

Running:

git clone https://github.com/riyadattani/weather_station_server.git
npm install
npm start

visit localhost:9000

Testing:

npm test

TDD Process

We employed a strict TDD process for the development of this app. We used the following test descriptions below:

Testing Root route '/':

  • response status should be 200

Testing the POST route:

  • returns a confirmation message
  • returns a helpful message if it couldn't save
  • response include the Mongo error if it couldn't save
  • saves the data in the database for a legit input
  • returns an error message if it doesn't validate
  • doesn't save the data in the database if it doesn't validate

Testing the standard GET route:

  • returns the posted data
  • returns an empty response if the database is empty

Testing the GET route with a datetime filter

  • if no initial datetime and no final datetime provided
    • Initial datetime defaults to 24 hours ago
    • Final datetime defaults to now
  • if initial datetime and final datetime provided
    • Use provided initial datetime
    • Use provided final datetime
  • if no initial datetime provided but final datetime provided
    • Initial datetime defaults to 24 hours before final datetime
    • Use provided final datetime
  • if initial datetime provided but no final datetime provided
    • Use provided initial datetime
    • Final datetime defaults to now

MongoDB

Connect to mongo production database:

mongo "mongodb+srv://weather-station-server-zrxmz.mongodb.net/test" --username weather-station-master

Sozza you need a password ;-)

weather_station_server's People

Contributors

hives avatar riyadattani avatar j-dav avatar ltarar avatar

Watchers

James Cloos 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.