-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmoge.js
25 lines (21 loc) · 912 Bytes
/
moge.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
var fs = require('fs');
var http = require('http');
var https = require('https');
var os = require("os");
var privateKey = fs.readFileSync('./ssl.key', 'utf8');
var certificate = fs.readFileSync('./ssl.crt', 'utf8');
var credentials = {key: privateKey, cert: certificate};
var express = require('express');
var app = express();
app.use(express.json());
app.use(express.urlencoded({ extended: true }));
app.post('/moge', function (req, res) {
console.log(req.method)
console.log(req.body)
console.log(process.memoryUsage())
res.send({"服务的路径和名称": __filename, "操作系统运行的时间": os.uptime(), "Moge已经运行的秒数": process.uptime(), "Moge世界所用的物理内存状况单位为字节": process.memoryUsage()})
})
var httpServer = http.createServer(app);
var httpsServer = https.createServer(credentials, app);
httpServer.listen(80);
httpsServer.listen(443);