Skip to content

Releases: cschuchardt88/neo-modules

RestServer-3.6.0-beta

28 Aug 02:28
Compare
Choose a tag to compare
RestServer-3.6.0-beta Pre-release
Pre-release

Adding to the RestServer's existing API.
This Dummy Plugin example adds routes to existing controller routes/paths. Nothing new here! Neo.Plugins.RestServer will automatically add controller classes to the Rest Server API.

RestClient Source Code
RestClient Binary Download - .Net Standard 2.1

Also you will see server: neo-cli/3.5.0 RestServer/3.5.0 in the header response to let you know this is the right server and good for spotting different versions of the application.

Key Features

  • Override Error Handling (for cleaner errors as json responses, will not crash clients or give unexpected error responses)
  • Compression
  • CORS
  • CORS Origins
  • HTTPS
  • Basic Authentication
  • Disable Controllers (from other plugins)
  • Proxy Forwards (for data center usage)
  • Wallet Sessions
  • Json Converter (for having parameter types like UInt160, UInt256, StackItem, etc)
  • Implements Contracts, Ledger, Node, Token, Wallet and Utils full functionality
  • Plugin Support (easy process with no dependencies to this library)
  • Cleaner Plugin Code (for new plugins)
  • Parameter Type Binding
  • Swagger UI

Dependencies

  • Microsoft.AspNetCore.JsonPatch.dll (Required)
  • Microsoft.AspNetCore.Mvc.NewtonsoftJson.dll (Required)
  • Microsoft.OpenApi.dll (for swagger to work)
  • Swashbuckle.AspNetCore.Swagger.dll (for swagger to work)
  • Swashbuckle.AspNetCore.SwaggerGen.dll (for swagger to work)
  • Swashbuckle.AspNetCore.SwaggerUI.dll (for swagger to work)
  • Swashbuckle.AspNetCore.Newtonsoft.dll (for swagger to work)
  • RestServer.xml _(for swagger UI to show description or the endpoints)
  • $(AssemblyPlugin).xml (for swagger UI to show descriptions of that plugin's endpoints)

Change Log

  • Ledger Controller API (Interaction Ability)
  • Contracts Controller API (Interaction Ability)
  • Neo/Gas Controller API (Display Accounts)
  • Node Controller API (Block Height, Peers and Other Information)
  • Token Controller API (Nep17/Nep11 Interaction)
  • Wallet Controller API (Open, Close, Transactions, etc)
  • Utils Controller API (Conversion Tools & Helpers)
  • Expandability (Rest Routes)
  • Enable Https
  • CORS
  • Response Compression (GZip)
  • Basic Authentication
  • The ability to disable controller routes
  • Any HTTP Method
  • Any Route
  • Custom HTTP Headers
  • Rest Client (No Dependencies Required) Get It Here
  • Wallet Sessions
  • Multi-thread
  • Swagger

Rest API

image

Neo-Cli Commands

image

You can just add Swagger OpenAPI 2.0 to any project by

Step1
image

Step 2
image

Step 3
image

Config File Description

Name Type Description
Network uint32 The network you would like the rest server to be enabled on.
BindAddress string The Ip address of the interface you want to bind too.
Port uint32 Port number to bind too.
KeepAliveTimeout uint32 The time to keep the request alive.
SslCertFile string is the path and file name of a certificate file, relative to the directory that contains the node's executable files.
SslCertPassword string is the password required to access the X.509 certificate data.
TrustedAuthorities StringArray Tumbprints of the of the last certificate authority in the chain.
EnableBasicAuthentication boolean enables basic authentication.
RestUser string Basic authentication's username.
RestPass string Basic authentication's password.
EnableCors boolean Enables Cross-origin resource sharing (CORS). Note by default it enables any origin.
AllowOrigins StringArray A list of the origins to allow. Note needs to add origins for basic auth to work with CORS.
DisableControllers StringArray A list of controllers to be disabled. Requires restart of the node, if changed.
EnableCompression boolean Enables response GZip data compression.
CompressionLevel enum Type of compression level. Values can be "Fastest" or "Optimal" or "NoCompression" or "SmallestSize"
EnableForwardedHeaders boolean Enables response/request headers for proxy forwarding.
EnableSwagger boolean Enables Swagger with Swagger UI for the rest services.
MaxPageSize uint32 Max page size for searches on Ledger/Contract routes.
MaxConcurrentConnections long64 Max allow concurrent HTTP connections.
MaxTransactionFee long64 Max transaction fee for wallet transfers.
MaxInvokeGas long64 Max gas to be invoked on the VM.
WalletTimeout int32 When wallet session expires. Note in minutes.