From a7486895ece09276a98d39d9aead8de3f487ac35 Mon Sep 17 00:00:00 2001 From: Justinas Ruslys Date: Tue, 22 Jun 2021 19:50:56 +0300 Subject: [PATCH] Initial commit --- .gitignore | 2 ++ client/css/styles.css | 34 +++++++++++++++++++++++ client/index.html | 40 +++++++++++++++++++++++++++ client/js/connection.js | 7 +++++ server/Program.cs | 26 +++++++++++++++++ server/Properties/launchSettings.json | 28 +++++++++++++++++++ server/Startup.cs | 40 +++++++++++++++++++++++++++ server/appsettings.Development.json | 9 ++++++ server/appsettings.json | 10 +++++++ server/server.csproj | 7 +++++ 10 files changed, 203 insertions(+) create mode 100644 .gitignore create mode 100644 client/css/styles.css create mode 100644 client/index.html create mode 100644 client/js/connection.js create mode 100644 server/Program.cs create mode 100644 server/Properties/launchSettings.json create mode 100644 server/Startup.cs create mode 100644 server/appsettings.Development.json create mode 100644 server/appsettings.json create mode 100644 server/server.csproj diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..890bb2e --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +server/bin +server/obj \ No newline at end of file diff --git a/client/css/styles.css b/client/css/styles.css new file mode 100644 index 0000000..e68d018 --- /dev/null +++ b/client/css/styles.css @@ -0,0 +1,34 @@ +body { + background-color: darkgray; +} + +.inputFields { + margin-top: 2%; +} + +html { + position: relative; + min-height: 100%; + } + body { + margin-bottom: 60px; /* Margin bottom by footer height */ + } + .footer { + position: absolute; + bottom: 0; + width: 100%; + height: 60px; /* Set the fixed height of the footer here */ + line-height: 60px; /* Vertically center the text there */ + background-color: #f5f5f5; + } + + + /* Custom page CSS + -------------------------------------------------- */ + /* Not required for template or sticky footer method. */ + + .container { + width: auto; + max-width: 680px; + padding: 0 15px; + } \ No newline at end of file diff --git a/client/index.html b/client/index.html new file mode 100644 index 0000000..4f3aa28 --- /dev/null +++ b/client/index.html @@ -0,0 +1,40 @@ + + + + + + + + Chat Room + + + + + + +
+
+

Welcome to a public chat room!

+
+
+ + + +
+
+
+ +
+ + + + + + + + + \ No newline at end of file diff --git a/client/js/connection.js b/client/js/connection.js new file mode 100644 index 0000000..f42c653 --- /dev/null +++ b/client/js/connection.js @@ -0,0 +1,7 @@ +const connectionUrl = "http://localhost:5000"; +const connectBtn = document.getElementById("connectBtn"); + +connectBtn.onclick = function() { + var inputs = document.getElementById("inputFields"); + inputs.innerHTML = ""; +} \ No newline at end of file diff --git a/server/Program.cs b/server/Program.cs new file mode 100644 index 0000000..2941ce6 --- /dev/null +++ b/server/Program.cs @@ -0,0 +1,26 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; +using Microsoft.AspNetCore.Hosting; +using Microsoft.Extensions.Configuration; +using Microsoft.Extensions.Hosting; +using Microsoft.Extensions.Logging; + +namespace server +{ + public class Program + { + public static void Main(string[] args) + { + CreateHostBuilder(args).Build().Run(); + } + + public static IHostBuilder CreateHostBuilder(string[] args) => + Host.CreateDefaultBuilder(args) + .ConfigureWebHostDefaults(webBuilder => + { + webBuilder.UseStartup(); + }); + } +} diff --git a/server/Properties/launchSettings.json b/server/Properties/launchSettings.json new file mode 100644 index 0000000..ddc49ee --- /dev/null +++ b/server/Properties/launchSettings.json @@ -0,0 +1,28 @@ +{ + "iisSettings": { + "windowsAuthentication": false, + "anonymousAuthentication": true, + "iisExpress": { + "applicationUrl": "http://localhost:57015", + "sslPort": 44367 + } + }, + "profiles": { + "IIS Express": { + "commandName": "IISExpress", + "launchBrowser": true, + "environmentVariables": { + "ASPNETCORE_ENVIRONMENT": "Development" + } + }, + "server": { + "commandName": "Project", + "dotnetRunMessages": "true", + "launchBrowser": true, + "applicationUrl": "https://localhost:5001;http://localhost:5000", + "environmentVariables": { + "ASPNETCORE_ENVIRONMENT": "Development" + } + } + } +} diff --git a/server/Startup.cs b/server/Startup.cs new file mode 100644 index 0000000..7a82415 --- /dev/null +++ b/server/Startup.cs @@ -0,0 +1,40 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; +using Microsoft.AspNetCore.Builder; +using Microsoft.AspNetCore.Hosting; +using Microsoft.AspNetCore.Http; +using Microsoft.Extensions.DependencyInjection; +using Microsoft.Extensions.Hosting; + +namespace server +{ + public class Startup + { + // This method gets called by the runtime. Use this method to add services to the container. + // For more information on how to configure your application, visit https://go.microsoft.com/fwlink/?LinkID=398940 + public void ConfigureServices(IServiceCollection services) + { + } + + // This method gets called by the runtime. Use this method to configure the HTTP request pipeline. + public void Configure(IApplicationBuilder app, IWebHostEnvironment env) + { + if (env.IsDevelopment()) + { + app.UseDeveloperExceptionPage(); + } + + app.UseRouting(); + + app.UseEndpoints(endpoints => + { + endpoints.MapGet("/", async context => + { + await context.Response.WriteAsync("Hello World!"); + }); + }); + } + } +} diff --git a/server/appsettings.Development.json b/server/appsettings.Development.json new file mode 100644 index 0000000..8983e0f --- /dev/null +++ b/server/appsettings.Development.json @@ -0,0 +1,9 @@ +{ + "Logging": { + "LogLevel": { + "Default": "Information", + "Microsoft": "Warning", + "Microsoft.Hosting.Lifetime": "Information" + } + } +} diff --git a/server/appsettings.json b/server/appsettings.json new file mode 100644 index 0000000..d9d9a9b --- /dev/null +++ b/server/appsettings.json @@ -0,0 +1,10 @@ +{ + "Logging": { + "LogLevel": { + "Default": "Information", + "Microsoft": "Warning", + "Microsoft.Hosting.Lifetime": "Information" + } + }, + "AllowedHosts": "*" +} diff --git a/server/server.csproj b/server/server.csproj new file mode 100644 index 0000000..842a770 --- /dev/null +++ b/server/server.csproj @@ -0,0 +1,7 @@ + + + + net5.0 + + +