Skip to content

Commit

Permalink
Merge pull request #127 from tjsr/develop/esh-config-types
Browse files Browse the repository at this point in the history
Use types from ESH library.
  • Loading branch information
tjsr authored Oct 22, 2024
2 parents f0288ce + 6936ff6 commit 96c7030
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 19 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"scripts": {
"clean": "npx rimraf dist build",
"clean:all": "npm run clean && npx rimraf build coverage dist node_modules",
"test": "vitest --run && npm run lint",
"test": "tsc && vitest --run && npm run lint",
"start:frontend": "cross-env GENERATE_SOURCEMAP=true PORT=3008 vite dev",
"start:dev": "nodemon index.ts && cross-env PORT=3008 vite dev",
"start:prod": "node index.js",
Expand Down
2 changes: 1 addition & 1 deletion src/types.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { ExpressServerConfig } from './types/expressConfig.js';
import { ExpressServerConfig } from '@tjsr/express-server-helper';
import { uuid5 } from '@tjsr/user-session-middleware';

export type UserId = uuid5;
Expand Down
18 changes: 1 addition & 17 deletions src/types/expressConfig.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { UserSessionOptions } from '@tjsr/user-session-middleware';
import cookieParser from 'cookie-parser';
import { ExpressServerConfig } from '@tjsr/express-server-helper';

export type Plugins =
| 'morgan'
Expand All @@ -11,21 +10,6 @@ export type Plugins =
| 'urlEncoded'
| 'json';

export type PluginKeys = {
[_key in Plugins]?: boolean | unknown;
};

export interface ExpressServerConfig extends PluginKeys {
cookieParserOptions?: cookieParser.CookieParseOptions;
cookieParserSecret?: string | string[];
exposeHeaders: string | undefined;
json: boolean;
sessionOptions: Partial<UserSessionOptions>;
// sessionStore?: session.Store;
trustProxy: boolean;
urlEncoded: boolean;
}

export const EXPRESS_DEFAULT_OPTIONS: ExpressServerConfig = {
// TODO: express-session no longer needs cookie parser, so if the app isn't using cookies, eg we're
// going to store all user data in a session, we don't need to use cookie-parser.
Expand Down

0 comments on commit 96c7030

Please sign in to comment.