Skip to content

junyussh/weather-api

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

37 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Weather API Server

A pure and light Weather API server build with Express framwork, based on Node.js and Redis.

The application is under Weather Station project.

Requirment

  • Node.js
  • npm or Yarn
  • Redis

Installation

You can install this application in easy command.

git clone https://github.com/junyussh/weather-api.git
npm install # use npm
yarn install # use Yarn

Configature

Edit config.json in root dictionary.

This is the config.json example.

{
    "info": { // you can add more details
        "location": "NHSH" // your location
    },
    "server": {
        "port": "8080" // Application Port
    },
    "database": {
        "key": "weather", // Redis database key name. Key name can't repeat with existed key name.
        "host": "127.0.0.1", // Redis database host
        "port": "6379"
    }
}

Usage

Basic

GET <host>:<port>/api // get your data in json string
POST <host>:<port>/api // write data to the Redis database

Params

size

The query string size can limit the number of records the API server get.

GET <host>:<port>/api?size=3 // return 3 records

Reference

License

BSD License

Releases

No releases published

Packages

No packages published