externalManageALocalServer
Hierarchy
- Ability
- ManageALocalServer
Index
Constructors
externalconstructor
Parameters
externalprotocol: SupportedProtocols
Protocol to be used when communicating with the running server;
http
orhttps
externalserver: Server
A Node.js server requestListener, with support for server shutdown.
Returns ManageALocalServer
Methods
staticexternalrunningAHttpListener
An
Ability
to manage a Node.js HTTP server using the providedrequestListener
.Parameters
externallistener: RequestListener | Server
Returns ManageALocalServer
staticexternalrunningAHttpsListener
An
Ability
to manage a Node.js HTTPS server using the provided serverrequestListener
.Parameters
externallistener: RequestListener | Server<typeof IncomingMessage, typeof ServerResponse>
externaloptions: ServerOptions<typeof IncomingMessage, typeof ServerResponse> = {}
Accepts an options object from
tls.createServer()
,tls.createSecureContext()
andhttp.createServer()
.
Returns ManageALocalServer
externaltoJSON
Returns a JSON representation of the ability and its current state, if available. The purpose of this method is to enable reporting the state of the ability in a human-readable format, rather than to serialise and deserialise the ability itself.
Returns SerialisedAbility
externalabilityType
Returns the most abstract type of this Ability instance, specifically the first class in the inheritance hierarchy that directly extends the
Ability
class.import { Ability } from '@serenity-js/core';
class MyAbility extends Ability {}
class MySpecialisedAbility extends MyAbility {}
new MyAbility().abilityType(); // returns MyAbility
new MySpecialisedAbility().abilityType(); // returns MyAbilityReturns AbilityType<Ability>
externallisten
Starts the server on the first free port between
preferredPort
andhighestPort
, inclusive.Parameters
externaloptionalpreferredPort: number = 8000
Lower bound of the preferred port range
externaloptionalhighestPort: number = 65535
highestPort Upper bound of the preferred port range
Returns Promise<void>
externalmapInstance
Provides access to the server
requestListener
Type parameters
- T
Parameters
externalfn: (server: ServerWithShutdown, protocol?: SupportedProtocols) => T
Returns T
An
Ability
that enables anActor
to manage a local Node.js server.Managing a raw Node.js server
Learn more