A pure and light Weather API server build with Express framwork, based on Node.js and Redis.
The application is under Weather Station project.
- Node.js
- npm or Yarn
- Redis
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
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"
}
}
GET <host>:<port>/api // get your data in json string
POST <host>:<port>/api // write data to the Redis database
The query string size
can limit the number of records the API server get.
GET <host>:<port>/api?size=3 // return 3 records