SPA task implemented

This commit is contained in:
Egor 2022-09-01 02:08:16 +03:00
parent 57eaccb746
commit dbccecc32f
16 changed files with 42846 additions and 0 deletions

25
SPATask/SPATask.sln Normal file
View file

@ -0,0 +1,25 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.3.32819.101
MinimumVisualStudioVersion = 10.0.40219.1
Project("{9092AA53-FB77-4645-B42D-1CCCA6BD08BD}") = "SPATask", "SPATask\SPATask.njsproj", "{BF55F855-0E32-47A5-90E5-F7BDFF292913}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{BF55F855-0E32-47A5-90E5-F7BDFF292913}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{BF55F855-0E32-47A5-90E5-F7BDFF292913}.Debug|Any CPU.Build.0 = Debug|Any CPU
{BF55F855-0E32-47A5-90E5-F7BDFF292913}.Release|Any CPU.ActiveCfg = Release|Any CPU
{BF55F855-0E32-47A5-90E5-F7BDFF292913}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {EA48109F-7B1C-4B7B-9A5E-0C81163D2AD6}
EndGlobalSection
EndGlobal

View file

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

View file

@ -0,0 +1,99 @@
<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>SPATask</Name>
<RootNamespace>SPATask</RootNamespace>
<EnableTypeScript>true</EnableTypeScript>
<TypeScriptSourceMap>true</TypeScriptSourceMap>
<TypeScriptModuleKind>CommonJS</TypeScriptModuleKind>
</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>bf55f855-0e32-47a5-90e5-f7bdff292913</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="dist\app-bundle.js" />
<Content Include="dist\app-bundle.js.map" />
<Content Include="index.html">
<SubType>Code</SubType>
</Content>
<Content Include="server.js" />
<Content Include="package.json" />
<Content Include="README.md" />
<Content Include="styles.less">
<SubType>Code</SubType>
</Content>
<Content Include="tsconfig.json">
<SubType>Code</SubType>
</Content>
<Content Include="webpack-config.js">
<SubType>Code</SubType>
</Content>
</ItemGroup>
<ItemGroup>
<TypeScriptCompile Include="app.tsx">
<SubType>Code</SubType>
</TypeScriptCompile>
</ItemGroup>
<ItemGroup>
<Folder Include="dist\" />
</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>

53
SPATask/SPATask/app.tsx Normal file
View file

@ -0,0 +1,53 @@
import * as React from 'react';
import * as ReactDOM from 'react-dom';
import { BrowserRouter as Router, Switch, Route, Link } from 'react-router-dom';
export const App = () => (
<Router>
<header>
<nav>
<ul>
<li>
<Link to="/">Home</Link>
</li>
<li>
<Link to="/users">Users</Link>
</li>
<li>
<Link to="/stat">Stat</Link>
</li>
<li>
<Link to="/messages">Messages</Link>
</li>
</ul>
</nav>
</header>
<main>
<Switch>
<Route path="/messages">
<Messages />
</Route>
<Route path="/stat">
<Stat />
</Route>
<Route path="/users">
<Users />
</Route>
<Route path="/">
<Home />
</Route>
</Switch>
</main>
</Router>
);
const Home = () => <h2>Home</h2>;
const Users = () => <h2>Users</h2>;
const Stat = () => <h2>Stat</h2>;
const Messages = () => <h2>Messages</h2>;
ReactDOM.render(<App />, document.getElementById('root'));

32735
SPATask/SPATask/dist/app-bundle.js vendored Normal file

File diff suppressed because it is too large Load diff

File diff suppressed because one or more lines are too long

View file

@ -0,0 +1,15 @@
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<link rel="stylesheet/less" type="text/css" href="./styles.less" />
<meta charset="utf-8" />
<title>SPATask</title>
</head>
<body>
<div id="root"></div>
<!-- scripts -->
<script src="./dist/app-bundle.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/less.js/2.5.1/less.min.js"></script>
</body>
</html>

9810
SPATask/SPATask/package-lock.json generated Normal file

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,23 @@
{
"name": "spatask",
"version": "1.0.0",
"description": "SPATask",
"main": "server.js",
"author": {
"name": ""
},
"dependencies": {
"express": "~4.17.1",
"path": "^0.12.7",
"react": "~16.13.1",
"react-dom": "~16.13.1",
"react-router-dom": "~5.3.3",
"ts-loader": "~7.0.1",
"typescript": "~3.8.3",
"webpack": "~4.42.1",
"webpack-cli": "~3.3.11"
},
"scripts": {
"build": "webpack-cli ./app.tsx --config webpack-config.js"
}
}

15
SPATask/SPATask/server.js Normal file
View file

@ -0,0 +1,15 @@
'use strict';
var path = require('path');
var express = require('express');
var app = express();
var staticPath = path.join(__dirname, '/');
app.use(express.static(staticPath));
// Allows you to set port in the project properties.
app.set('port', process.env.PORT || 3000);
var server = app.listen(app.get('port'), function () {
console.log('listening');
});

View file

@ -0,0 +1,28 @@
nav {
height: 100%;
width: 200px;
position: fixed;
z-index: 1;
top: 0;
left: 0;
background-color: #111;
overflow-x: hidden;
padding-top: 20px;
}
nav a {
padding: 6px 6px 6px 32px;
text-decoration: none;
font-size: 25px;
color: #818181;
display: block;
}
nav a:hover {
color: #f1f1f1;
}
main {
font-size: 32px;
margin-left: 220px;
}

View file

@ -0,0 +1,17 @@
{
"compilerOptions": {
"noImplicitAny": false,
"module": "commonjs",
"noEmitOnError": true,
"removeComments": false,
"sourceMap": true,
"target": "es5",
"jsx": "react"
},
"exclude": [
"node_modules"
],
"files": [
"app.tsx"
]
}

View file

@ -0,0 +1,22 @@
module.exports = {
devtool: 'source-map',
entry: "./app.tsx",
mode: "development",
output: {
filename: "./app-bundle.js"
},
resolve: {
extensions: ['.Webpack.js', '.web.js', '.ts', '.js', '.jsx', '.tsx']
},
module: {
rules: [
{
test: /\.tsx$/,
exclude: /(node_modules|bower_components)/,
use: {
loader: 'ts-loader'
}
}
]
}
}