# Node

    public class Node

Node is a class that wraps a golang `node` object

Should not be used on its own

Show on GitHub

- `init(_:)`

  Class constructor using repo passed as parameter as node repo

  Throws

  `NodeError`: If the creation of the node failed

  #### Declaration

  Swift

      public init(_ repo: Repo) throws

  #### Parameters

  `repo` | The repo of the node

  Show on GitHub
- `close()`

  Closes this node instance

  Throws

  `NodeError`: If the closing of the node failed

  #### Declaration

  Swift

      public func close() throws

  Show on GitHub
- `serveAPI(onUDS:)`

  Serves node API over UDS

  Throws

  `NodeError`: If the node failed to serve

  #### Declaration

  Swift

      public func serveAPI(onUDS: String) throws

  #### Parameters

  `onUDS` | The UDS path to serve on

  Show on GitHub
- `serveAPI(onTCPPort:)`

  Serves node API over TCP

  Throws

  `NodeError`: If the node failed to serve

  #### Declaration

  Swift

      public func serveAPI(onTCPPort: String) throws -> String

  #### Parameters

  `onTCPPort` | The TCP port to serve on

  #### Return Value

  The TCP/IP MultiAddr the node is serving on

  Show on GitHub
- `serveGateway(onMultiaddr:writable:)`

  Serves node Gateway over the given Multiaddr

  Throws

  `NodeError`: If the node failed to serve

  #### Declaration

  Swift

      public func serveGateway(onMultiaddr: String, writable: Bool = false) throws -> String

  #### Parameters

  `onMultiaddr` | The multiaddr to serve on
  `writable` | If true: will also support support `POST`, `PUT`, and `DELETE` methods.

  Show on GitHub
- `serve()`

  Serves any multiaddr (api & gateway) inside `Addresses.Api` and `Addresses.Gateway` in the config (if any)

  Throws

  `NodeError`: If the node failed to serve

  #### Declaration

  Swift

      public func serve() throws

  #### Return Value

  The TCP/IP MultiAddr the node is serving on

  Show on GitHub

© 2022 . All rights reserved. (Last updated: 2022-12-05)

Generated by jazzy ♪♫ v0.14.3, a Realm project.