Cloud API Overview > @adpt/cloud > nodejs > default
nodejs.default() function
A partially abstract component that builds Node.js source code into a Container and exposes a NetworkService.
Signature:
export declare function NodeService(props: SFCDeclProps<NodeServiceProps, typeof defaultProps>): Adapt.AdaptElement<Adapt.AnyProps>;
Parameters
Parameter | Type | Description |
---|---|---|
props | SFCDeclProps<NodeServiceProps, typeof defaultProps> | See nodejs.NodeServiceProps |
Returns:
Adapt.AdaptElement<Adapt.AnyProps>
Remarks
To use this component, the srcDir
prop must be the path to the root of a Node.js project, which contains a package.json file. The component will build a Docker container image by:
starting with an official Node.js base image
copying
srcDir
into the container imageexecuting
npm run build
setting the container CMD to execute the
main
file specified in package.json
Abstract components:
This component uses the following abstract components which must be replaced via style sheet rules:
The NetworkService and Container components are both children of the Service component.
Instance methods:
hostname(): string | undefined
Returns the hostname of the NetworkService, once it is known.
port(): number | undefined
Returns the port number of the NetworkService, once it is known.
image():
docker.ImageInfo |undefined
Information about the successfully built image, once it has been built.