feat: Add file based ResourceStore (#52)

* feat: Add file resource store

* test: Write some tests for FileResourceStore

* fix: Reformat code and fix various small things from reviews

* fix: Change constants to just be the corresponding URL

* fix: Remove extra unnecessary wrap in a Promise

* fix: Write some more tests and fix related bugs

* fix: Use old way to import fs promises to support older Node versions

* refactor: Refactor code and tests

* refactor: Refactor and better document code

* fix: Change comparison with undefined by typeof check

* fix: Invert typeof check
This commit is contained in:
smessie
2020-08-18 14:19:25 +02:00
committed by GitHub
parent e06d0bc8c5
commit 381dae42f6
13 changed files with 1199 additions and 7 deletions

View File

@@ -0,0 +1,9 @@
import { HttpError } from './HttpError';
/**
* An error thrown when a request conflict with current state of the server.
*/
export class ConflictHttpError extends HttpError {
public constructor(message?: string) {
super(409, 'ConflictHttpError', message);
}
}

View File

@@ -0,0 +1,9 @@
import { HttpError } from './HttpError';
/**
* An error thrown when data was found for the requested identifier, but is not supported by the target resource.
*/
export class MethodNotAllowedHttpError extends HttpError {
public constructor(message?: string) {
super(405, 'MethodNotAllowedHttpError', message);
}
}