Skip to content

COSCUP/COSCUP-2020-room-status-backend

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Room Status Backend

A simple backend for COSCUP 2020 website to retrieve room status from google spreadsheet, and notify client to request api.

Quick Start

  1. Add environment variable GOOGLE_SHEETS_API_KEY (Get API key from https://console.cloud.google.com/apis/credentials)
$ export GOOGLE_SHEETS_API_KEY=XXXXXXXXXXXXXXXXXXXXXXXX
  1. Install dependencies
$ npm i
  1. Start (listening on port 7788)
$ npm run start

Description

It's just a simple backend that retrieve data from google spreadsheet and cache the result each 5 seconds. If the data changed, it would notify clients through the sockets. (It would accept all CORS by default.)

(You need to connect socket to the server origin, Socket.io is used in both sides of server and client)

API

There's only a single event update for socket and it would be without any payload.

There's only a single GET HTTP api.

  • GET /api/rooms_status

    {
      "roomsStatus": [
        {
          "id": String,
          "isFull": Boolean
        }
      ]
    }

License

MIT

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published