Pārlūkot izejas kodu

Добавьте файлы проекта.

Maxim Shihov 1 gadu atpakaļ
vecāks
revīzija
8f72a756fa

+ 25 - 0
OAKS_LABS.sln

@@ -0,0 +1,25 @@
+
+Microsoft Visual Studio Solution File, Format Version 12.00
+# Visual Studio Version 17
+VisualStudioVersion = 17.7.34221.43
+MinimumVisualStudioVersion = 10.0.40219.1
+Project("{9092AA53-FB77-4645-B42D-1CCCA6BD08BD}") = "OAKS_LABS", "OAKS_LABS\OAKS_LABS.njsproj", "{40E9EDEB-EA5B-4CA2-BAB5-305D11971F01}"
+EndProject
+Global
+	GlobalSection(SolutionConfigurationPlatforms) = preSolution
+		Debug|Any CPU = Debug|Any CPU
+		Release|Any CPU = Release|Any CPU
+	EndGlobalSection
+	GlobalSection(ProjectConfigurationPlatforms) = postSolution
+		{40E9EDEB-EA5B-4CA2-BAB5-305D11971F01}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+		{40E9EDEB-EA5B-4CA2-BAB5-305D11971F01}.Debug|Any CPU.Build.0 = Debug|Any CPU
+		{40E9EDEB-EA5B-4CA2-BAB5-305D11971F01}.Release|Any CPU.ActiveCfg = Release|Any CPU
+		{40E9EDEB-EA5B-4CA2-BAB5-305D11971F01}.Release|Any CPU.Build.0 = Release|Any CPU
+	EndGlobalSection
+	GlobalSection(SolutionProperties) = preSolution
+		HideSolutionNode = FALSE
+	EndGlobalSection
+	GlobalSection(ExtensibilityGlobals) = postSolution
+		SolutionGuid = {EBD22EB0-82B8-4A55-8119-0425B38D7DE5}
+	EndGlobalSection
+EndGlobal

+ 19 - 0
OAKS_LABS/Info.html

@@ -0,0 +1,19 @@
+<!DOCTYPE html>
+
+<html lang="en" xmlns="http://www.w3.org/1999/xhtml">
+<head>
+    <meta charset="utf-8" />
+    <title></title>
+</head>
+<body>
+    <h1>Шихов М. Е.</h1>
+    <p>группа 702</p>
+    <button onclick="handleOk()">ОК</button>
+
+    <script>
+        function handleOk() {
+            window.location.href = 'OK.html';
+        }
+    </script>
+</body>
+</html>

+ 53 - 0
OAKS_LABS/Lab1.txt

@@ -0,0 +1,53 @@
+const http = require('http');
+const fs = require('fs');
+
+const server = http.createServer((req, res) => {
+    if (req.url === '/') {
+        fs.readFile('Info.html', (err, data) => {
+            if (err) {
+                res.statusCode = 500;
+                res.setHeader('Content-Type', 'text/plain');
+                res.end('Internal Server Error');
+                return;
+            }
+
+            res.statusCode = 200;
+            res.setHeader('Content-Type', 'text/html; charset=utf-8');
+            res.end(data);
+        });
+    } else if (req.url === '/OK.html') {
+        fs.readFile('OK.html', (err, data) => {
+            if (err) {
+                res.statusCode = 500;
+                res.setHeader('Content-Type', 'text/plain');
+                res.end('Internal Server Error');
+                return;
+            }
+
+            res.statusCode = 200;
+            res.setHeader('Content-Type', 'text/html; charset=utf-8');
+            res.end(data);
+        });
+    } else if (req.url === '/Info.html') {
+        fs.readFile('Info.html', (err, data) => {
+            if (err) {
+                res.statusCode = 500;
+                res.setHeader('Content-Type', 'text/plain');
+                res.end('Internal Server Error');
+                return;
+            }
+
+            res.statusCode = 200;
+            res.setHeader('Content-Type', 'text/html; charset=utf-8');
+            res.end(data);
+        });
+    } else {
+        res.statusCode = 404;
+        res.setHeader('Content-Type', 'text/plain');
+        res.end('Not Found');
+    }
+});
+
+server.listen(8080, 'localhost', () => {
+    console.log('Server running: http://localhost:8080/');
+});

+ 74 - 0
OAKS_LABS/OAKS_LABS.njsproj

@@ -0,0 +1,74 @@
+<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="4.0">
+  <PropertyGroup>
+    <VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">14.0</VisualStudioVersion>
+    <VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath>
+    <Name>OAKS_LABS</Name>
+    <RootNamespace>OAKS_LABS</RootNamespace>
+  </PropertyGroup>
+  <Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
+  <PropertyGroup>
+    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+    <SchemaVersion>2.0</SchemaVersion>
+    <ProjectGuid>40e9edeb-ea5b-4ca2-bab5-305d11971f01</ProjectGuid>
+    <ProjectHome>.</ProjectHome>
+    <StartupFile>server.js</StartupFile>
+    <SearchPath>
+    </SearchPath>
+    <WorkingDirectory>.</WorkingDirectory>
+    <OutputPath>.</OutputPath>
+    <TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
+    <ProjectTypeGuids>{3AF33F2E-1136-4D97-BBB7-1795711AC8B8};{349c5851-65df-11da-9384-00065b846f21};{9092AA53-FB77-4645-B42D-1CCCA6BD08BD}</ProjectTypeGuids>
+    <NodejsPort>1337</NodejsPort>
+    <StartWebBrowser>true</StartWebBrowser>
+  </PropertyGroup>
+  <PropertyGroup Condition=" '$(Configuration)' == 'Debug' ">
+    <DebugSymbols>true</DebugSymbols>
+  </PropertyGroup>
+  <PropertyGroup Condition=" '$(Configuration)' == 'Release' ">
+    <DebugSymbols>true</DebugSymbols>
+  </PropertyGroup>
+  <ItemGroup>
+    <Content Include="server.js" />
+    <Content Include="package.json" />
+    <Content Include="README.md" />
+  </ItemGroup>
+  <Import Project="$(VSToolsPath)\Node.js Tools\Microsoft.NodejsToolsV2.targets" />
+  <ProjectExtensions>
+    <VisualStudio>
+      <FlavorProperties GUID="{349c5851-65df-11da-9384-00065b846f21}">
+        <WebProjectProperties>
+          <UseIIS>False</UseIIS>
+          <AutoAssignPort>True</AutoAssignPort>
+          <DevelopmentServerPort>0</DevelopmentServerPort>
+          <DevelopmentServerVPath>/</DevelopmentServerVPath>
+          <IISUrl>http://localhost:48022/</IISUrl>
+          <NTLMAuthentication>False</NTLMAuthentication>
+          <UseCustomServer>True</UseCustomServer>
+          <CustomServerUrl>http://localhost:1337</CustomServerUrl>
+          <SaveServerSettingsInUserFile>False</SaveServerSettingsInUserFile>
+        </WebProjectProperties>
+      </FlavorProperties>
+      <FlavorProperties GUID="{349c5851-65df-11da-9384-00065b846f21}" User="">
+        <WebProjectProperties>
+          <StartPageUrl>
+          </StartPageUrl>
+          <StartAction>CurrentPage</StartAction>
+          <AspNetDebugging>True</AspNetDebugging>
+          <SilverlightDebugging>False</SilverlightDebugging>
+          <NativeDebugging>False</NativeDebugging>
+          <SQLDebugging>False</SQLDebugging>
+          <ExternalProgram>
+          </ExternalProgram>
+          <StartExternalURL>
+          </StartExternalURL>
+          <StartCmdLineArguments>
+          </StartCmdLineArguments>
+          <StartWorkingDirectory>
+          </StartWorkingDirectory>
+          <EnableENC>False</EnableENC>
+          <AlwaysStartWebServerOnDebug>False</AlwaysStartWebServerOnDebug>
+        </WebProjectProperties>
+      </FlavorProperties>
+    </VisualStudio>
+  </ProjectExtensions>
+</Project>

+ 18 - 0
OAKS_LABS/OK.html

@@ -0,0 +1,18 @@
+<!DOCTYPE html>
+
+<html lang="en" xmlns="http://www.w3.org/1999/xhtml">
+<head>
+    <meta charset="utf-8" />
+    <title></title>
+</head>
+<body>
+    <h1>HTTP-статус 200</h1>
+    <button onclick="handleInfo()">Info</button>
+
+    <script>
+     function handleInfo() {
+         window.location.href = 'Info.html';
+     }
+    </script>
+</body>
+</html>

+ 3 - 0
OAKS_LABS/README.md

@@ -0,0 +1,3 @@
+# OAKS_LABS
+
+

+ 19 - 0
OAKS_LABS/lab1(Info).txt

@@ -0,0 +1,19 @@
+<!DOCTYPE html>
+
+<html lang="en" xmlns="http://www.w3.org/1999/xhtml">
+<head>
+    <meta charset="utf-8" />
+    <title></title>
+</head>
+<body>
+    <h1>Шихов М. Е.</h1>
+    <p>группа 702</p>
+    <button onclick="handleOk()">ОК</button>
+
+    <script>
+        function handleOk() {
+            window.location.href = 'OK.html';
+        }
+    </script>
+</body>
+</html>

Failā izmaiņas netiks attēlotas, jo tās ir par lielu
+ 1944 - 0
OAKS_LABS/package-lock.json


+ 13 - 0
OAKS_LABS/package.json

@@ -0,0 +1,13 @@
+{
+  "name": "oaks_labs",
+  "version": "0.0.0",
+  "description": "OAKS_LABS",
+  "main": "server.js",
+  "author": {
+    "name": ""
+  },
+  "devDependencies": {
+    "eslint": "^8.52.0"
+  },
+  "eslintConfig": {}
+}

+ 53 - 0
OAKS_LABS/server.js

@@ -0,0 +1,53 @@
+const http = require('http');
+const fs = require('fs');
+
+const server = http.createServer((req, res) => {
+    if (req.url === '/') {
+        fs.readFile('Info.html', (err, data) => {
+            if (err) {
+                res.statusCode = 500;
+                res.setHeader('Content-Type', 'text/plain');
+                res.end('Internal Server Error');
+                return;
+            }
+
+            res.statusCode = 200;
+            res.setHeader('Content-Type', 'text/html; charset=utf-8');
+            res.end(data);
+        });
+    } else if (req.url === '/OK.html') {
+        fs.readFile('OK.html', (err, data) => {
+            if (err) {
+                res.statusCode = 500;
+                res.setHeader('Content-Type', 'text/plain');
+                res.end('Internal Server Error');
+                return;
+            }
+
+            res.statusCode = 200;
+            res.setHeader('Content-Type', 'text/html; charset=utf-8');
+            res.end(data);
+        });
+    } else if (req.url === '/Info.html') {
+        fs.readFile('Info.html', (err, data) => {
+            if (err) {
+                res.statusCode = 500;
+                res.setHeader('Content-Type', 'text/plain');
+                res.end('Internal Server Error');
+                return;
+            }
+
+            res.statusCode = 200;
+            res.setHeader('Content-Type', 'text/html; charset=utf-8');
+            res.end(data);
+        });
+    } else {
+        res.statusCode = 404;
+        res.setHeader('Content-Type', 'text/plain');
+        res.end('Not Found');
+    }
+});
+
+server.listen(8080, 'localhost', () => {
+    console.log('Server running: http://localhost:8080/');
+});