Skip to main content

Interface: JovaServerOptions

Defined in: src/types/jova/config/interfaces/jovaServerOptionsObject.ts:31

Properties

basePath?

optional basePath: string

Defined in: src/types/jova/config/interfaces/jovaServerOptionsObject.ts:46

Name

basePath

Description

An optional base path for all of your routes to begin at.

Example

"/api"

cors?

optional cors: CorsOptions

Defined in: src/types/jova/config/interfaces/jovaServerOptionsObject.ts:116

Name

cors

Description

Enable cors and set up certain values for the cors middleware.

Default

undefined

customHeaders?

optional customHeaders: JovaHeaderSetting[]

Defined in: src/types/jova/config/interfaces/jovaServerOptionsObject.ts:109

Name

customHeaders

Description

Custom headers to be applied to outgoing responses, this is a middleware of optional use but the headers put in here are read-only at runtime until the request is received by a request handler.

Default

[]

customOptions?

optional customOptions: JovaCustomOption[]

Defined in: src/types/jova/config/interfaces/jovaServerOptionsObject.ts:102

Name

customOptions

Description

Custom options from express to be set upon the server starting, similar to settings but this sets any value unlike settings which only allows settings from the JovaSettingsOptions enum.

Default

[]

customrc?

optional customrc: string

Defined in: src/types/jova/config/interfaces/jovaServerOptionsObject.ts:130

Name

customrc

Description

Define a custom resource config file for the Jova config to be loaded from.

Default

undefined

logger?

optional logger: LoggerOptions

Defined in: src/types/jova/config/interfaces/jovaServerOptionsObject.ts:123

Name

logger

Description

Options for the logger output of Jova.js. Utilise the package @bracketed/logger for an understanding on how the configuration works.

Default

{}

middlewares?

optional middlewares: RequestHandler[]

Defined in: src/types/jova/config/interfaces/jovaServerOptionsObject.ts:62

Name

middlewares

Description

An array containing middlewares you would like to use in your application.

Middlewares built to support Express only, or alternatively you can write them in yourself.

Example

// An example of a middleware component coded raw into Jova's Middleware Array.
((request: Request, response: Response, next: NextFunction) => {
console.log(`New request at ${request.path}!`)
return next()
})

paths?

optional paths: JovaPathSettings

Defined in: src/types/jova/config/interfaces/jovaServerOptionsObject.ts:38

Name

paths

Description

Deploy example middlewares and routes when running the Jova.js Server.


port?

optional port: string | number

Defined in: src/types/jova/config/interfaces/jovaServerOptionsObject.ts:69

Name

port

Description

The port for the Jova Server to run on.

Default

3000

ratelimiting?

optional ratelimiting: RatelimitConfig

Defined in: src/types/jova/config/interfaces/jovaServerOptionsObject.ts:88

Name

ratelimiting

Description

The ratelimit config for a Jova Server Instance.

Default

undefined // (Disabled by default)

Example

// Config types for the ratelimiting feature for Jova
interface LimitConfig {
refreshTime: number;
requestLimitAmount: number | Middleware;
requestLimitMessage?: string;
requestLimitCode?: string;
requestLimitHandler?: Middleware;
countFailedRequests?: boolean;
allowOnInternalError?: boolean;
ratelimitDatabase?: string | RatelimitDatabaseConfig;
}

settings?

optional settings: JovaSettings

Defined in: src/types/jova/config/interfaces/jovaServerOptionsObject.ts:95

Name

settings

Description

Custom settings from express to be enabled or disabled upon the server starting.

Default

undefined

static?

optional static: object

Defined in: src/types/jova/config/interfaces/jovaServerOptionsObject.ts:136

dir

dir: string

Name

dir

Description

The directory for hosting static files, defaults to the same working directory that routes, events and middlewares are looked for under the folder name of static.

Default
undefined

options?

optional options: ServeStaticConfig

Name

options

Description

Options for serve-static.

Default
undefined

Name

static

Description

Configuration options for express.static. Static serving is automatically started when the static folder is found.

Default

undefined