Servicii pe docker cu diverse aplicatii: python, node, php, .net
This commit is contained in:
12
www/node_script.js
Normal file
12
www/node_script.js
Normal file
@@ -0,0 +1,12 @@
|
||||
const http = require("http");
|
||||
|
||||
const PORT = process.env.PORT || 8090;
|
||||
|
||||
const server = http.createServer((req, res) => {
|
||||
res.writeHead(200, { "Content-Type": "text/plain; charset=utf-8" });
|
||||
res.end("Salut! Node.js rulează pe portul " + PORT + "\n");
|
||||
});
|
||||
|
||||
server.listen(PORT, "0.0.0.0", () => {
|
||||
console.log(`Node server: http://0.0.0.0:${PORT}`);
|
||||
});
|
||||
10
www/programDotNet/ProgramDotNet.cs
Normal file
10
www/programDotNet/ProgramDotNet.cs
Normal file
@@ -0,0 +1,10 @@
|
||||
var builder = WebApplication.CreateBuilder(args);
|
||||
|
||||
// ascultă pe 0.0.0.0:8085
|
||||
builder.WebHost.UseUrls("http://0.0.0.0:8085");
|
||||
|
||||
var app = builder.Build();
|
||||
|
||||
app.MapGet("/", () => "Salut! .NET rulează pe 8085. fisier updatat");
|
||||
|
||||
app.Run();
|
||||
BIN
www/programDotNet/bin/Debug/net8.0/programDotNet
Executable file
BIN
www/programDotNet/bin/Debug/net8.0/programDotNet
Executable file
Binary file not shown.
23
www/programDotNet/bin/Debug/net8.0/programDotNet.deps.json
Normal file
23
www/programDotNet/bin/Debug/net8.0/programDotNet.deps.json
Normal file
@@ -0,0 +1,23 @@
|
||||
{
|
||||
"runtimeTarget": {
|
||||
"name": ".NETCoreApp,Version=v8.0",
|
||||
"signature": ""
|
||||
},
|
||||
"compilationOptions": {},
|
||||
"targets": {
|
||||
".NETCoreApp,Version=v8.0": {
|
||||
"programDotNet/1.0.0": {
|
||||
"runtime": {
|
||||
"programDotNet.dll": {}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"libraries": {
|
||||
"programDotNet/1.0.0": {
|
||||
"type": "project",
|
||||
"serviceable": false,
|
||||
"sha512": ""
|
||||
}
|
||||
}
|
||||
}
|
||||
BIN
www/programDotNet/bin/Debug/net8.0/programDotNet.dll
Normal file
BIN
www/programDotNet/bin/Debug/net8.0/programDotNet.dll
Normal file
Binary file not shown.
BIN
www/programDotNet/bin/Debug/net8.0/programDotNet.pdb
Normal file
BIN
www/programDotNet/bin/Debug/net8.0/programDotNet.pdb
Normal file
Binary file not shown.
@@ -0,0 +1,19 @@
|
||||
{
|
||||
"runtimeOptions": {
|
||||
"tfm": "net8.0",
|
||||
"frameworks": [
|
||||
{
|
||||
"name": "Microsoft.NETCore.App",
|
||||
"version": "8.0.0"
|
||||
},
|
||||
{
|
||||
"name": "Microsoft.AspNetCore.App",
|
||||
"version": "8.0.0"
|
||||
}
|
||||
],
|
||||
"configProperties": {
|
||||
"System.GC.Server": true,
|
||||
"System.Runtime.Serialization.EnableUnsafeBinaryFormatterSerialization": false
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
{"Version":1,"ManifestType":"Build","Endpoints":[]}
|
||||
@@ -0,0 +1,4 @@
|
||||
// <autogenerated />
|
||||
using System;
|
||||
using System.Reflection;
|
||||
[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(".NETCoreApp,Version=v8.0", FrameworkDisplayName = ".NET 8.0")]
|
||||
BIN
www/programDotNet/obj/Debug/net8.0/apphost
Executable file
BIN
www/programDotNet/obj/Debug/net8.0/apphost
Executable file
Binary file not shown.
@@ -0,0 +1,22 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was generated by a tool.
|
||||
//
|
||||
// Changes to this file may cause incorrect behavior and will be lost if
|
||||
// the code is regenerated.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
using System;
|
||||
using System.Reflection;
|
||||
|
||||
[assembly: System.Reflection.AssemblyCompanyAttribute("programDotNet")]
|
||||
[assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")]
|
||||
[assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")]
|
||||
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0")]
|
||||
[assembly: System.Reflection.AssemblyProductAttribute("programDotNet")]
|
||||
[assembly: System.Reflection.AssemblyTitleAttribute("programDotNet")]
|
||||
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")]
|
||||
|
||||
// Generated by the MSBuild WriteCodeFragment class.
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
ef4e0c11006f2dd239d8ab66d729a68f61d4fa32924b55c8329b555050161ab2
|
||||
@@ -0,0 +1,23 @@
|
||||
is_global = true
|
||||
build_property.TargetFramework = net8.0
|
||||
build_property.TargetFrameworkIdentifier = .NETCoreApp
|
||||
build_property.TargetFrameworkVersion = v8.0
|
||||
build_property.TargetPlatformMinVersion =
|
||||
build_property.UsingMicrosoftNETSdkWeb = true
|
||||
build_property.ProjectTypeGuids =
|
||||
build_property.InvariantGlobalization =
|
||||
build_property.PlatformNeutralAssembly =
|
||||
build_property.EnforceExtendedAnalyzerRules =
|
||||
build_property._SupportedPlatformList = Linux,macOS,Windows
|
||||
build_property.RootNamespace = programDotNet
|
||||
build_property.RootNamespace = programDotNet
|
||||
build_property.ProjectDir = /app/
|
||||
build_property.EnableComHosting =
|
||||
build_property.EnableGeneratedComInterfaceComImportInterop =
|
||||
build_property.RazorLangVersion = 8.0
|
||||
build_property.SupportLocalizedComponentNames =
|
||||
build_property.GenerateRazorMetadataSourceChecksumAttributes =
|
||||
build_property.MSBuildProjectDirectory = /app
|
||||
build_property._RazorSourceGeneratorDebug =
|
||||
build_property.EffectiveAnalysisLevelStyle = 8.0
|
||||
build_property.EnableCodeStyleSeverity =
|
||||
@@ -0,0 +1,17 @@
|
||||
// <auto-generated/>
|
||||
global using Microsoft.AspNetCore.Builder;
|
||||
global using Microsoft.AspNetCore.Hosting;
|
||||
global using Microsoft.AspNetCore.Http;
|
||||
global using Microsoft.AspNetCore.Routing;
|
||||
global using Microsoft.Extensions.Configuration;
|
||||
global using Microsoft.Extensions.DependencyInjection;
|
||||
global using Microsoft.Extensions.Hosting;
|
||||
global using Microsoft.Extensions.Logging;
|
||||
global using System;
|
||||
global using System.Collections.Generic;
|
||||
global using System.IO;
|
||||
global using System.Linq;
|
||||
global using System.Net.Http;
|
||||
global using System.Net.Http.Json;
|
||||
global using System.Threading;
|
||||
global using System.Threading.Tasks;
|
||||
BIN
www/programDotNet/obj/Debug/net8.0/programDotNet.assets.cache
Normal file
BIN
www/programDotNet/obj/Debug/net8.0/programDotNet.assets.cache
Normal file
Binary file not shown.
@@ -0,0 +1 @@
|
||||
78e56dd823ebe82c5116b011dea1d4f07d11c07a6cbca67c3b275ceeafa27f13
|
||||
@@ -0,0 +1,26 @@
|
||||
/app/obj/Debug/net8.0/programDotNet.GeneratedMSBuildEditorConfig.editorconfig
|
||||
/app/obj/Debug/net8.0/programDotNet.AssemblyInfoInputs.cache
|
||||
/app/obj/Debug/net8.0/programDotNet.AssemblyInfo.cs
|
||||
/app/obj/Debug/net8.0/programDotNet.csproj.CoreCompileInputs.cache
|
||||
/app/obj/Debug/net8.0/programDotNet.MvcApplicationPartsAssemblyInfo.cache
|
||||
/app/bin/Debug/net8.0/programDotNet
|
||||
/app/bin/Debug/net8.0/programDotNet.deps.json
|
||||
/app/bin/Debug/net8.0/programDotNet.runtimeconfig.json
|
||||
/app/bin/Debug/net8.0/programDotNet.dll
|
||||
/app/bin/Debug/net8.0/programDotNet.pdb
|
||||
/app/obj/Debug/net8.0/staticwebassets.build.json
|
||||
/app/obj/Debug/net8.0/staticwebassets.development.json
|
||||
/app/obj/Debug/net8.0/scopedcss/bundle/programDotNet.styles.css
|
||||
/app/obj/Debug/net8.0/programDotNet.dll
|
||||
/app/obj/Debug/net8.0/refint/programDotNet.dll
|
||||
/app/obj/Debug/net8.0/programDotNet.pdb
|
||||
/app/obj/Debug/net8.0/programDotNet.genruntimeconfig.cache
|
||||
/app/obj/Debug/net8.0/ref/programDotNet.dll
|
||||
/app/bin/Debug/net8.0/programDotNet.staticwebassets.endpoints.json
|
||||
/app/obj/Debug/net8.0/rpswa.dswa.cache.json
|
||||
/app/obj/Debug/net8.0/rjimswa.dswa.cache.json
|
||||
/app/obj/Debug/net8.0/rjsmrazor.dswa.cache.json
|
||||
/app/obj/Debug/net8.0/rjsmcshtml.dswa.cache.json
|
||||
/app/obj/Debug/net8.0/staticwebassets.build.json.cache
|
||||
/app/obj/Debug/net8.0/staticwebassets.build.endpoints.json
|
||||
/app/obj/Debug/net8.0/swae.build.ex.cache
|
||||
BIN
www/programDotNet/obj/Debug/net8.0/programDotNet.dll
Normal file
BIN
www/programDotNet/obj/Debug/net8.0/programDotNet.dll
Normal file
Binary file not shown.
@@ -0,0 +1 @@
|
||||
6c6db989a285f699deea041ae91957c98d32357a05190823d5ccb6d286e83fec
|
||||
BIN
www/programDotNet/obj/Debug/net8.0/programDotNet.pdb
Normal file
BIN
www/programDotNet/obj/Debug/net8.0/programDotNet.pdb
Normal file
Binary file not shown.
BIN
www/programDotNet/obj/Debug/net8.0/ref/programDotNet.dll
Normal file
BIN
www/programDotNet/obj/Debug/net8.0/ref/programDotNet.dll
Normal file
Binary file not shown.
BIN
www/programDotNet/obj/Debug/net8.0/refint/programDotNet.dll
Normal file
BIN
www/programDotNet/obj/Debug/net8.0/refint/programDotNet.dll
Normal file
Binary file not shown.
@@ -0,0 +1 @@
|
||||
{"GlobalPropertiesHash":"fLV7naKvKWbTYVUHjkIjTJtm/olHDr/EnsWwdgzzqYA=","FingerprintPatternsHash":"gq3WsqcKBUGTSNle7RKKyXRIwh7M8ccEqOqYvIzoM04=","PropertyOverridesHash":"8ZRc1sGeVrPBx4lD717BgRaQekyh78QKV9SKsdt638U=","InputHashes":["bzO0TEjhBVNhYEvqtsf/ty9AgBtGHyRIrjLs/G4sxxw="],"CachedAssets":{},"CachedCopyCandidates":{}}
|
||||
@@ -0,0 +1 @@
|
||||
{"GlobalPropertiesHash":"MMRCzYhPUzk/dvjkevA6gVPm5Xq+/bKRMXBsywen2EU=","FingerprintPatternsHash":"gq3WsqcKBUGTSNle7RKKyXRIwh7M8ccEqOqYvIzoM04=","PropertyOverridesHash":"8ZRc1sGeVrPBx4lD717BgRaQekyh78QKV9SKsdt638U=","InputHashes":["bzO0TEjhBVNhYEvqtsf/ty9AgBtGHyRIrjLs/G4sxxw="],"CachedAssets":{},"CachedCopyCandidates":{}}
|
||||
@@ -0,0 +1 @@
|
||||
{"Version":1,"ManifestType":"Build","Endpoints":[]}
|
||||
@@ -0,0 +1 @@
|
||||
{"Version":1,"Hash":"R9B4kODIeQ+F5JrbWKZU4XVNo0G1PgbmB01uJL2Dn04=","Source":"programDotNet","BasePath":"/","Mode":"Root","ManifestType":"Build","ReferencedProjectsConfiguration":[],"DiscoveryPatterns":[],"Assets":[],"Endpoints":[]}
|
||||
@@ -0,0 +1 @@
|
||||
R9B4kODIeQ+F5JrbWKZU4XVNo0G1PgbmB01uJL2Dn04=
|
||||
84
www/programDotNet/obj/programDotNet.csproj.nuget.dgspec.json
Normal file
84
www/programDotNet/obj/programDotNet.csproj.nuget.dgspec.json
Normal file
@@ -0,0 +1,84 @@
|
||||
{
|
||||
"format": 1,
|
||||
"restore": {
|
||||
"/app/programDotNet.csproj": {}
|
||||
},
|
||||
"projects": {
|
||||
"/app/programDotNet.csproj": {
|
||||
"version": "1.0.0",
|
||||
"restore": {
|
||||
"projectUniqueName": "/app/programDotNet.csproj",
|
||||
"projectName": "programDotNet",
|
||||
"projectPath": "/app/programDotNet.csproj",
|
||||
"packagesPath": "/root/.nuget/packages/",
|
||||
"outputPath": "/app/obj/",
|
||||
"projectStyle": "PackageReference",
|
||||
"configFilePaths": [
|
||||
"/root/.nuget/NuGet/NuGet.Config"
|
||||
],
|
||||
"originalTargetFrameworks": [
|
||||
"net8.0"
|
||||
],
|
||||
"sources": {
|
||||
"https://api.nuget.org/v3/index.json": {}
|
||||
},
|
||||
"frameworks": {
|
||||
"net8.0": {
|
||||
"targetAlias": "net8.0",
|
||||
"projectReferences": {}
|
||||
}
|
||||
},
|
||||
"warningProperties": {
|
||||
"warnAsError": [
|
||||
"NU1605"
|
||||
]
|
||||
},
|
||||
"restoreAuditProperties": {
|
||||
"enableAudit": "true",
|
||||
"auditLevel": "low",
|
||||
"auditMode": "direct"
|
||||
},
|
||||
"SdkAnalysisLevel": "10.0.100"
|
||||
},
|
||||
"frameworks": {
|
||||
"net8.0": {
|
||||
"targetAlias": "net8.0",
|
||||
"imports": [
|
||||
"net461",
|
||||
"net462",
|
||||
"net47",
|
||||
"net471",
|
||||
"net472",
|
||||
"net48",
|
||||
"net481"
|
||||
],
|
||||
"assetTargetFallback": true,
|
||||
"warn": true,
|
||||
"downloadDependencies": [
|
||||
{
|
||||
"name": "Microsoft.AspNetCore.App.Ref",
|
||||
"version": "[8.0.22, 8.0.22]"
|
||||
},
|
||||
{
|
||||
"name": "Microsoft.NETCore.App.Host.linux-arm64",
|
||||
"version": "[8.0.22, 8.0.22]"
|
||||
},
|
||||
{
|
||||
"name": "Microsoft.NETCore.App.Ref",
|
||||
"version": "[8.0.22, 8.0.22]"
|
||||
}
|
||||
],
|
||||
"frameworkReferences": {
|
||||
"Microsoft.AspNetCore.App": {
|
||||
"privateAssets": "none"
|
||||
},
|
||||
"Microsoft.NETCore.App": {
|
||||
"privateAssets": "all"
|
||||
}
|
||||
},
|
||||
"runtimeIdentifierGraphPath": "/usr/share/dotnet/sdk/10.0.101/PortableRuntimeIdentifierGraph.json"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
15
www/programDotNet/obj/programDotNet.csproj.nuget.g.props
Normal file
15
www/programDotNet/obj/programDotNet.csproj.nuget.g.props
Normal file
@@ -0,0 +1,15 @@
|
||||
<?xml version="1.0" encoding="utf-8" standalone="no"?>
|
||||
<Project ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup Condition=" '$(ExcludeRestorePackageImports)' != 'true' ">
|
||||
<RestoreSuccess Condition=" '$(RestoreSuccess)' == '' ">True</RestoreSuccess>
|
||||
<RestoreTool Condition=" '$(RestoreTool)' == '' ">NuGet</RestoreTool>
|
||||
<ProjectAssetsFile Condition=" '$(ProjectAssetsFile)' == '' ">$(MSBuildThisFileDirectory)project.assets.json</ProjectAssetsFile>
|
||||
<NuGetPackageRoot Condition=" '$(NuGetPackageRoot)' == '' ">/root/.nuget/packages/</NuGetPackageRoot>
|
||||
<NuGetPackageFolders Condition=" '$(NuGetPackageFolders)' == '' ">/root/.nuget/packages/</NuGetPackageFolders>
|
||||
<NuGetProjectStyle Condition=" '$(NuGetProjectStyle)' == '' ">PackageReference</NuGetProjectStyle>
|
||||
<NuGetToolVersion Condition=" '$(NuGetToolVersion)' == '' ">7.0.0</NuGetToolVersion>
|
||||
</PropertyGroup>
|
||||
<ItemGroup Condition=" '$(ExcludeRestorePackageImports)' != 'true' ">
|
||||
<SourceRoot Include="/root/.nuget/packages/" />
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
@@ -0,0 +1,2 @@
|
||||
<?xml version="1.0" encoding="utf-8" standalone="no"?>
|
||||
<Project ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" />
|
||||
89
www/programDotNet/obj/project.assets.json
Normal file
89
www/programDotNet/obj/project.assets.json
Normal file
@@ -0,0 +1,89 @@
|
||||
{
|
||||
"version": 3,
|
||||
"targets": {
|
||||
"net8.0": {}
|
||||
},
|
||||
"libraries": {},
|
||||
"projectFileDependencyGroups": {
|
||||
"net8.0": []
|
||||
},
|
||||
"packageFolders": {
|
||||
"/root/.nuget/packages/": {}
|
||||
},
|
||||
"project": {
|
||||
"version": "1.0.0",
|
||||
"restore": {
|
||||
"projectUniqueName": "/app/programDotNet.csproj",
|
||||
"projectName": "programDotNet",
|
||||
"projectPath": "/app/programDotNet.csproj",
|
||||
"packagesPath": "/root/.nuget/packages/",
|
||||
"outputPath": "/app/obj/",
|
||||
"projectStyle": "PackageReference",
|
||||
"configFilePaths": [
|
||||
"/root/.nuget/NuGet/NuGet.Config"
|
||||
],
|
||||
"originalTargetFrameworks": [
|
||||
"net8.0"
|
||||
],
|
||||
"sources": {
|
||||
"https://api.nuget.org/v3/index.json": {}
|
||||
},
|
||||
"frameworks": {
|
||||
"net8.0": {
|
||||
"targetAlias": "net8.0",
|
||||
"projectReferences": {}
|
||||
}
|
||||
},
|
||||
"warningProperties": {
|
||||
"warnAsError": [
|
||||
"NU1605"
|
||||
]
|
||||
},
|
||||
"restoreAuditProperties": {
|
||||
"enableAudit": "true",
|
||||
"auditLevel": "low",
|
||||
"auditMode": "direct"
|
||||
},
|
||||
"SdkAnalysisLevel": "10.0.100"
|
||||
},
|
||||
"frameworks": {
|
||||
"net8.0": {
|
||||
"targetAlias": "net8.0",
|
||||
"imports": [
|
||||
"net461",
|
||||
"net462",
|
||||
"net47",
|
||||
"net471",
|
||||
"net472",
|
||||
"net48",
|
||||
"net481"
|
||||
],
|
||||
"assetTargetFallback": true,
|
||||
"warn": true,
|
||||
"downloadDependencies": [
|
||||
{
|
||||
"name": "Microsoft.AspNetCore.App.Ref",
|
||||
"version": "[8.0.22, 8.0.22]"
|
||||
},
|
||||
{
|
||||
"name": "Microsoft.NETCore.App.Host.linux-arm64",
|
||||
"version": "[8.0.22, 8.0.22]"
|
||||
},
|
||||
{
|
||||
"name": "Microsoft.NETCore.App.Ref",
|
||||
"version": "[8.0.22, 8.0.22]"
|
||||
}
|
||||
],
|
||||
"frameworkReferences": {
|
||||
"Microsoft.AspNetCore.App": {
|
||||
"privateAssets": "none"
|
||||
},
|
||||
"Microsoft.NETCore.App": {
|
||||
"privateAssets": "all"
|
||||
}
|
||||
},
|
||||
"runtimeIdentifierGraphPath": "/usr/share/dotnet/sdk/10.0.101/PortableRuntimeIdentifierGraph.json"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
12
www/programDotNet/obj/project.nuget.cache
Normal file
12
www/programDotNet/obj/project.nuget.cache
Normal file
@@ -0,0 +1,12 @@
|
||||
{
|
||||
"version": 2,
|
||||
"dgSpecHash": "83bfm2dKkvU=",
|
||||
"success": true,
|
||||
"projectFilePath": "/app/programDotNet.csproj",
|
||||
"expectedPackageFiles": [
|
||||
"/root/.nuget/packages/microsoft.netcore.app.ref/8.0.22/microsoft.netcore.app.ref.8.0.22.nupkg.sha512",
|
||||
"/root/.nuget/packages/microsoft.aspnetcore.app.ref/8.0.22/microsoft.aspnetcore.app.ref.8.0.22.nupkg.sha512",
|
||||
"/root/.nuget/packages/microsoft.netcore.app.host.linux-arm64/8.0.22/microsoft.netcore.app.host.linux-arm64.8.0.22.nupkg.sha512"
|
||||
],
|
||||
"logs": []
|
||||
}
|
||||
7
www/programDotNet/programDotNet.csproj
Normal file
7
www/programDotNet/programDotNet.csproj
Normal file
@@ -0,0 +1,7 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk.Web">
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net8.0</TargetFramework>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
</PropertyGroup>
|
||||
</Project>
|
||||
45
www/script_php.php
Executable file
45
www/script_php.php
Executable file
@@ -0,0 +1,45 @@
|
||||
#!/usr/bin/env php
|
||||
<?php
|
||||
declare(strict_types=1);
|
||||
|
||||
/**
|
||||
* Rulare:
|
||||
* php script.php --name=Daniel --amount=125.50
|
||||
*/
|
||||
|
||||
function usage(): void {
|
||||
echo "Usage: php script.php --name=NAME --amount=NUMBER\n";
|
||||
exit(1);
|
||||
}
|
||||
|
||||
$options = getopt("", ["name:", "amount:"]);
|
||||
$name = $options["name"] ?? null;
|
||||
$amount = $options["amount"] ?? null;
|
||||
|
||||
if ($name === null || $amount === null) {
|
||||
usage();
|
||||
}
|
||||
|
||||
if (!is_numeric($amount)) {
|
||||
fwrite(STDERR, "Error: --amount must be numeric.\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
$amount = (float)$amount;
|
||||
$vatRate = 0.19; // TVA 19%
|
||||
$vat = round($amount * $vatRate, 2);
|
||||
$total = round($amount + $vat, 2);
|
||||
|
||||
$result = [
|
||||
"name" => $name,
|
||||
"amount" => $amount,
|
||||
"vat" => $vat,
|
||||
"total" => $total,
|
||||
"time" => date("c"),
|
||||
];
|
||||
|
||||
echo json_encode($result, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE) . PHP_EOL;
|
||||
|
||||
// scrie și un log local
|
||||
$logLine = $result["time"] . " | {$name} | amount={$amount} | vat={$vat} | total={$total}\n";
|
||||
file_put_contents(__DIR__ . "/script.log", $logLine, FILE_APPEND);
|
||||
17
www/script_python2.py
Normal file
17
www/script_python2.py
Normal file
@@ -0,0 +1,17 @@
|
||||
#!/usr/bin/env python3
|
||||
from http.server import BaseHTTPRequestHandler, HTTPServer
|
||||
|
||||
class Handler(BaseHTTPRequestHandler):
|
||||
def do_GET(self):
|
||||
self.send_response(200)
|
||||
self.send_header("Content-Type", "text/plain; charset=utf-8")
|
||||
self.end_headers()
|
||||
self.wfile.write(b"Salut! Server Python 2 ruleaza pe portul 8088")
|
||||
|
||||
def main():
|
||||
server = HTTPServer(("0.0.0.0", 8088), Handler)
|
||||
print("Python server pornit pe http://0.0.0.0:8088")
|
||||
server.serve_forever()
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
Reference in New Issue
Block a user