https://github.com/ramtinsoltani/releasedates-backend-public
The backend server for the ReleaseDates.io Angular app.
https://github.com/ramtinsoltani/releasedates-backend-public
Last synced: 4 months ago
JSON representation
The backend server for the ReleaseDates.io Angular app.
- Host: GitHub
- URL: https://github.com/ramtinsoltani/releasedates-backend-public
- Owner: ramtinsoltani
- Created: 2018-02-27T12:42:41.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2018-03-02T02:27:19.000Z (over 7 years ago)
- Last Synced: 2025-01-10T03:48:25.009Z (5 months ago)
- Language: JavaScript
- Size: 45.9 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# ReleaseDates.io Backend Server
This server is made with Node JS and Express for the ReleaseDates.io Angular web application to wrap TheTVDB and DailyMotion APIs.
## Installation, Configuration, and Running
1. Clone the repo
2. Run `npm install`
3. Clone the `config.sample.js` to `config.js` (copy, paste, rename).
3. Set the `firebaseAdminCertificate` in `config.js` to your Firebase Admin SDK Certificate obtained from your Firebase project's settings
4. Obtain an API key from TheTVDB by registering and generating a key in your account, then set the `thetvdb.key` in `config.js` with the API key
5. Review the `config.js` comments and configure your server (`thetvdb.tokenRefreshTime`, `firebaseAuthenticationRequired`, etc.)
6. Run `node index` to start the server locally on port 3000## Authentication
The server uses Firebase token verification to authenticate requests. The token is automatically obtained by the web application and provided using the `token` query parameter on all requests (non-logged in users are automatically logged in as anonymous users and therefore have a valid ID token).
This behavior can be turned off by setting `firebaseAuthenticationRequired` property to `false` in `config.js`.
## Routes & Query Params
**Note:** The response types refer to the Backend models in the Angular app.
| Route | Query Params | Description | Response |
|:-----:|:------------:|:------------|:---------|
| /test | token | A simple route to test if the server is running and the authentication is working. | {everythingWorking: true} or [Error](#error) |
| /search | token, q | Searches for the given query in TheTVDB and returns the results with posters and thumbnails. | [SearchResult](#searchresult)[] or [Error](#error) |
| /series | token, id | Hits multiple API routes of TheTVDB and returns all the data needed by the Angular app for the given series ID. | [Series](#series) or [Error](#error) |
| /videos | token, q | Searches the DailyMotion API for the given query and returns results with thumbnails and URLs. | [VideosResult](#videosresult)[] or [Error](#error) |
| /updates | token, id, since | Gets updates for the given series since the given Epoch time. | [Update](#update) or [Error](#error) |
| /discover | token, *[count]* | Randomly picks from the most recently updated series within the last week. The count query determines how many series to pick and must be between 1 to 100. If not provided or invalid, this value defaults to 20. Keep in mind that some discovered series can lack name and posters! | [Discovered[]](#discovered) or [Error](#error) |## Response Types
### SearchResult
```json
{
"id": 0,
"name": "",
"posters": [{
"poster": "",
"thumbnail": ""
}]
}
```### Series
```json
{
"id": 0,
"name": "",
"status": "",
"overview": "",
"network": "",
"rating": 0,
"imdbLink": "",
"airDate": "",
"runtime": "",
"genre": [""],
"posters": [{
"poster": "",
"thumbnail": ""
}],
"totalSeasons": 0,
"totalEpisodes": 0,
"seasons": [{
"number": 0,
"episodes": [{
"number": 0,
"name": "",
"overview": "",
"airDate": ""
}]
}]
}
```### VideosResult
```json
{
"title": "",
"duration": "",
"url": "",
"thumbnail": ""
}
```### Update
```json
{
"hasUpdates": true,
"lastUpdated": 0,
"episodes": [{
"number": 0,
"hasName": true,
"airDate": 0
}]
}
```### Discovered
```json
{
"name": "",
"id": 0,
"posters": [{
"poster": "",
"thumbnail": ""
}]
}
```### Error
```json
{
"error": true,
"message": ""
}
```