Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
S
shouzhouServer
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
chenjinjing
shouzhouServer
Commits
c0e15878
Commit
c0e15878
authored
Jul 01, 2024
by
chenjinjing
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' of
http://123.207.147.179:8888/chenjinjing/shouzhouServer
parents
e0819d19
2cc8719b
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
42 additions
and
5 deletions
+42
-5
package-lock.json
package-lock.json
+1
-2
package.json
package.json
+4
-1
serverConfig.ts
src/config/serverConfig.ts
+18
-0
main.ts
src/main.ts
+2
-2
http_server.ts
src/net/http_server.ts
+17
-0
No files found.
package-lock.json
View file @
c0e15878
...
...
@@ -33,8 +33,7 @@
},
"bin"
:
{
"screen"
:
"out/main.js"
},
"devDependencies"
:
{}
}
},
"node_modules/@alicloud/dybaseapi"
:
{
"version"
:
"1.0.0"
,
...
...
package.json
View file @
c0e15878
...
...
@@ -27,7 +27,10 @@
"
xml2js
"
:
"^0.4.23"
},
"scripts"
:
{
"test"
:
"echo
\"
Error: no test specified
\"
&& exit 1"
"test"
:
"echo
\"
Error: no test specified
\"
&& exit 1"
,
"build"
:
"tsc"
,
"start"
:
"node out/main.js"
,
"dev"
:
"npx ts-node src/main.ts"
},
"author"
:
"cjj"
,
"license"
:
"
ISC
"
,
...
...
src/config/serverConfig.ts
0 → 100644
View file @
c0e15878
interface
SystemConfig
{
port
:
number
;
}
const
systemConfig
:
SystemConfig
=
{
port
:
3000
};
async
function
initConfig
():
Promise
<
void
>
{
return
new
Promise
((
resolve
)
=>
{
setTimeout
(()
=>
{
console
.
log
(
"Configuration Initialized"
);
resolve
();
},
1000
);
});
}
export
{
initConfig
,
systemConfig
};
src/main.ts
View file @
c0e15878
import
{
httpServer
}
from
"./net/http_server"
;
import
{
initConfig
,
systemConfig
}
from
"./config/serverConfig"
;
import
{
test2
}
from
"./test"
;
//
import { test2 } from "./test";
let
fs
=
require
(
'fs'
);
async
function
lanuch
()
{
...
...
@@ -8,7 +8,7 @@ async function lanuch() {
httpServer
.
createServer
(
systemConfig
.
port
);
console
.
log
(
'This indicates that the server is started successfully.'
);
// test();
test2
();
//
test2();
}
lanuch
();
...
...
src/net/http_server.ts
0 → 100644
View file @
c0e15878
import
*
as
http
from
'http'
;
const
httpServer
=
{
createServer
(
port
:
number
):
void
{
const
server
=
http
.
createServer
((
req
,
res
)
=>
{
res
.
statusCode
=
200
;
res
.
setHeader
(
'Content-Type'
,
'text/plain'
);
res
.
end
(
'Hello World
\
n'
);
});
server
.
listen
(
port
,
()
=>
{
console
.
log
(
`Server running at http://localhost:
${
port
}
/`
);
});
}
};
export
{
httpServer
};
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment