dependabot[bot] 23f87d376a Bump dotenv from 17.2.1 to 17.2.2
Bumps [dotenv](https://github.com/motdotla/dotenv) from 17.2.1 to 17.2.2.
- [Changelog](https://github.com/motdotla/dotenv/blob/master/CHANGELOG.md)
- [Commits](https://github.com/motdotla/dotenv/compare/v17.2.1...v17.2.2)

---
updated-dependencies:
- dependency-name: dotenv
  dependency-version: 17.2.2
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-09-10 12:59:11 +10:00
2025-09-09 18:55:55 +10:00
2025-07-26 03:58:38 +10:00
2021-12-23 13:57:52 +00:00
2024-05-03 09:28:39 +10:00
2021-07-23 19:21:21 +10:00
2021-03-07 13:53:29 +11:00
2024-05-03 09:28:39 +10:00
2023-01-12 08:08:22 +11:00
2025-09-10 12:59:11 +10:00
2024-05-03 09:28:39 +10:00

news-server

An API centric news server. Uses Sequelize and mariaDB by default.

This server is available via docker hub at krgamestudios/news-server.

Setup

There are multiple ways to run this app - it can run on it's own via npm start (for production) or npm run dev (for development). it can also run inside docker using docker compose up --build - run node configure-script.js to generate docker-compose.yml and startup.sql.

To generate an authorization token, use auth-server. A public-facing development auth-server is available here (tokens are valid for 10 minutes):

POST https://dev-auth.krgamestudios.com/auth/login HTTP/1.1
Content-Type: application/json

{
	"email": "example@example.com",
	"password": "helloworld"
}

API

GET /news/:id?

Get either an array of articles (newest first), or a specified article if the optional "id" parameter is given.

Response Body

[{
	// [Number] index of the article
	"index": index,

	// [String] author of the article
	"author": author,

	// [String] raw body of the article
	"body": body,

	// [Number] number of times this article has been edited
	"edits": edits,

	// [String] body of the article rendered as HTML
	"rendered": rendered,

	// [String] title of the article
	"title": title,

	// [Date] time article was created
	"createdAt": createdAt,

	// [Date] time article was updated
	"updatedAt": updatedAt,
}]

Available Query Parameters

  • fields
    • TYPE: string A comma separated list of the field names you want returning, (index will always be returned)
  • page
    • TYPE: number The current page you want returning
  • page_size
    • TYPE: number The number of results to return. This superseeds the PAGE_SIZE environment variable for the query

Note

If a specific article is requested, then just that article is returned rather than an array

GET /news/archive/:id?

Get either an array of articles (oldest first), or a specified article if the optional "id" parameter is given.

Response Body

[{
	// [Number] index of the article
	"index": index,

	// [String] author of the article
	"author": author,

	// [String] raw body of the article
	"body": body,

	// [Number] number of times this article has been edited
	"edits": edits,

	// [String] body of the article rendered as HTML
	"rendered": rendered,

	// [String] title of the article
	"title": title,

	// [Date] time article was created
	"createdAt": createdAt,

	// [Date] time article was updated
	"updatedAt": updatedAt,
}]

Available Query Parameters

  • fields
    • TYPE: string A comma separated list of the field names you want returning, (index will always be returned)
  • page
    • TYPE: number The current page you want returning
  • page_size
    • TYPE: number The number of results to return. This superseeds the PAGE_SIZE environment variable for the query

Note

If a specific article is requested, then just that article is returned rather than an array

GET /news/metadata/:id?

Get either an array of metadata (newest first), or a specified article's metadata if the optional "id" parameter is given.

Response Body

[{
	// [Number] index of the article
	"index": index,

	// [String] author of the article
	"author": author,

	// [Number] number of times this article has been edited
	"edits": edits,

	// [String] title of the article
	"title": title,

	// [Date] time article was created
	"createdAt": createdAt,

	// [Date] time article was updated
	"updatedAt": updatedAt,
}]

Available Query Parameters

  • fields
    • TYPE: string A comma separated list of the field names you want returning, (index will always be returned)
  • page
    • TYPE: number The current page you want returning
  • page_size
    • TYPE: number The number of results to return. This superseeds the PAGE_SIZE environment variable for the query

Note

If a specific article is requested, then just that article is returned rather than an array

GET /news/archive/metadata/:id?

Get either an array of metadata (oldest first), or a specified article's metadata if the optional "id" parameter is given.

Response Body

[{
	// [Number] index of the article
	"index": index,

	// [String] author of the article
	"author": author,

	// [Number] number of times this article has been edited
	"edits": edits,

	// [String] title of the article
	"title": title,

	// [Date] time article was created
	"createdAt": createdAt,

	// [Date] time article was updated
	"updatedAt": updatedAt,
}]

Available Query Parameters

  • fields
    • TYPE: string A comma separated list of the field names you want returning, (index will always be returned)
  • page
    • TYPE: number The current page you want returning
  • page_size
    • TYPE: number The number of results to return. This supersedes the PAGE_SIZE environment variable for the query

Note

If a specific article is requested, then just that article is returned rather than an array


POST /news

Important

Requires valid JWT Authorization header (Authorization: Bearer XXX)

Create a new article resource, returns either the new article's index on success, or an error on failure.

Request Body

{
	// [String] OPTIONAL: title of the article
	"title": title,

	// [String] OPTIONAL: author of the article
	"author": author,

	// [String] OPTIONAL: body of the article
	"body": body,
}

Response Body

{
	// [Number]: new index of the article
	"index": index,
}

PATCH /news/:id

Important

Requires valid JWT Authorization header (Authorization: Bearer XXX)

Update an existing article resource, returns either status code 200 on success, or an error status on failure.

Request Body

{
	// [String] OPTIONAL: title of the article
	"title": title,

	// [String] OPTIONAL: author of the article
	"author": author,

	// [String] OPTIONAL: body of the article
	"body": body,
}

DELETE /news/:id

Important

Requires valid JWT Authorization header (Authorization: Bearer XXX)

Remove an existing article resource from the news feed, returns either status code 200 on success, or an error status on failure.

S
Description
An API centric news server.
Readme Zlib 314 KiB
Languages
JavaScript 98.6%
Dockerfile 1.4%