neo-project / neo-modules

MIT License
60 stars 100 forks source link

Rest server #839

Closed cschuchardt88 closed 5 months ago

cschuchardt88 commented 12 months ago

RestServer

In this section you will learn about RestServer plugin and how it works.

Dependencies

In Docker

RestServer
|   |   |-- Microsoft.AspNetCore.JsonPatch.dll
|   |   |-- Microsoft.AspNetCore.Mvc.NewtonsoftJson.dll
|   |   |-- Microsoft.AspNetCore.Mvc.Versioning.ApiExplorer.dll
|   |   |-- Microsoft.AspNetCore.Mvc.Versioning.dll
|   |   |-- Microsoft.OpenApi.dll
|   |   |-- Neo.ConsoleService.dll
|   |   |-- Newtonsoft.Json.Bson.dll
|   |   |-- Newtonsoft.Json.dll
|   |   |-- RestServer.deps.json
|   |   |-- RestServer.dll
|   |   |-- RestServer.pdb
|   |   |-- RestServer.xml
|   |   |-- Swashbuckle.AspNetCore.Newtonsoft.dll
|   |   |-- Swashbuckle.AspNetCore.Swagger.dll
|   |   |-- Swashbuckle.AspNetCore.SwaggerGen.dll
|   |   |-- Swashbuckle.AspNetCore.SwaggerUI.dll
|   |   |-- System.ServiceProcess.ServiceController.dll
|   |   |-- config.json
|   |   `-- runtimes
|   |       `-- win
|   |           `-- lib
|   |               `-- net6.0
|   |                   `-- System.ServiceProcess.ServiceController.dll

These files go in the same directory as the RestServer.dll. In neo-cli plugins/RestServer/ folder.

Response Headers

Name Value(s) Description
server neo-cli/3.6.0 RestServer/3.6.0 neo-cli and RestServer version.

JSON Serializer

RestServer uses custom Newtonsoft Json Converters to serialize controller action responses and route parameters.

One Way Binding - Write only.

Two Way Binding - Read & Write

Remote Endpoints

Parametes {hash} can be any Neo N3 address or scripthash; {address} can be any Neo N3 address only; {number} and {index} can be any uint32.

Parameter Examples

Paths

vncoelho commented 9 months ago

I am seeing the dockerfile you send now. Let me understand, it is both building and running.

cschuchardt88 commented 9 months ago

Its two options you can try, Full version of Ubuntu

under the horizontal line is an other option to try.

vncoelho commented 9 months ago

Its two options you can try, Full version of Ubuntu

under the horizontal line is an other option to try.

That is a drastic change for a PR that simple was intended to remove AspNet. All this should had been discussed and stated before the change. Too much instability.

cschuchardt88 commented 9 months ago

Its not the removal of asp.net core, its just my code in this pr. Try to disable swagger.

cschuchardt88 commented 9 months ago
ARG REPO=mcr.microsoft.com/dotnet/runtime-deps

# Installer image
FROM amd64/buildpack-deps:jammy-curl AS installer

# Retrieve ASP.NET Core
RUN aspnetcore_version=7.0.14 \
    && curl -fSL --output aspnetcore.tar.gz https://dotnetcli.azureedge.net/dotnet/aspnetcore/Runtime/$aspnetcore_version/aspnetcore-runtime-$aspnetcore_version-linux-x64.tar.gz \
    && aspnetcore_sha512='00f55556cb580d81bf0059a61a642ed8b405452d55e94460c03a0edec9a4f608fd78561560e5fc5bf6e42fb1f45420eba75f8d102d8bd46686379dab7ffde6f6' \
    && echo "$aspnetcore_sha512  aspnetcore.tar.gz" | sha512sum -c - \
    && tar -oxzf aspnetcore.tar.gz ./shared/Microsoft.AspNetCore.App \
    && rm aspnetcore.tar.gz

# ASP.NET Core image
FROM $REPO:7.0.14-jammy-amd64

# ASP.NET Core version
ENV ASPNET_VERSION=7.0.14

COPY --from=installer ["/shared/Microsoft.AspNetCore.App", "/usr/share/dotnet/shared/Microsoft.AspNetCore.App"]
vncoelho commented 9 months ago
mcr.microsoft.com/dotnet/runtime-deps

That looks like to be too much specific configurations, @cschuchardt88.

From this code I could see that maybe dotnet/runtime-deps: .NET Runtime Dependencies is better than dotnet/aspnet: ASP.NET Core Runtime for this PR. But it is not clear to me.

cschuchardt88 commented 9 months ago

Above was a modified version of the asp.net core dockerfile.

vncoelho commented 9 months ago

Above was a modified version of the asp.net core dockerfile.

I do not understand this still, @cschuchardt88. A modified version of asp.net core...aehauheauea

I think we should do something very very simpler for now. Keeping compatibility at max. Later (when we merge devpack and module), and when we have a complete integrate environment (more workflows as you are proposing in other PRs), when we optimize and improve packages and these things. At least for me, it is becoming a little bit more complex for what was quite simple.

cschuchardt88 commented 9 months ago

What you can do is use asp.net core image add Argument REPO and set it two mcr.microsoft.com/dotnet/runtime-deps

cschuchardt88 commented 9 months ago

I have ran into this problem before with docker, and my restserver

cschuchardt88 commented 9 months ago

image

Works fine

vncoelho commented 9 months ago

@shargon, the error was Sqlitewallet auto dependency injection. So, I think we are fine now. Everything I tested here is ok. Are we ready to go?

cschuchardt88 commented 9 months ago

very nice

cschuchardt88 commented 8 months ago

@shargon @Jim8y This already been tested and reviewed by @superboyiii. However @vncoelho caused a seen, that ended up being false.

shargon commented 8 months ago

I will review it likely the next week (working of bug fixes now).

cschuchardt88 commented 7 months ago

Ready for merge https://github.com/neo-project/neo-modules/pull/839#discussion_r1530025463

shargon commented 5 months ago

Repository moved to neo, please re-open there