Test
This commit is contained in:
parent
61139207fc
commit
5fba7b1699
6 changed files with 33 additions and 18 deletions
1
bin/start.js
Normal file
1
bin/start.js
Normal file
|
@ -0,0 +1 @@
|
|||
#!/usr/bin/env node
|
3
cm.js
Normal file
3
cm.js
Normal file
|
@ -0,0 +1,3 @@
|
|||
module.exports = {
|
||||
'0': 'HelloWorld'
|
||||
}
|
3
config.js
Normal file
3
config.js
Normal file
|
@ -0,0 +1,3 @@
|
|||
module.exports = {
|
||||
port: 4000
|
||||
}
|
14
package.json
14
package.json
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "@thundernetworkrad/mit.db",
|
||||
"version": "2022.12.29",
|
||||
"version": "2023.01.11",
|
||||
"description": "An online server for quickmap.db",
|
||||
"main": "index.js",
|
||||
"scripts": {
|
||||
|
@ -19,9 +19,15 @@
|
|||
"url": "https://github.com/ThunderNetworkRaD/mit.db/issues"
|
||||
},
|
||||
"homepage": "https://github.com/ThunderNetworkRaD/mit.db#readme",
|
||||
"bin": {
|
||||
"start": "./bin/start.js",
|
||||
"version": ""
|
||||
},
|
||||
"dependencies": {
|
||||
"colors": "^1.4.0",
|
||||
"quickmap.db": "^2022.12.29",
|
||||
"readline-sync": "^1.4.10"
|
||||
"@thundernetworkrad/colors": "^2023.1.10",
|
||||
"@thundernetworkrad/map.db": "^2022.12.29",
|
||||
"@thundernetworkrad/readline-sync": "^2023.1.10",
|
||||
"express": "^4.18.2",
|
||||
"yargs": "^17.6.2"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,14 +0,0 @@
|
|||
/*module.exports = function (interface) {
|
||||
if (interface == 'gui') {
|
||||
async function home() {
|
||||
std.cin('MitDB >'.red)
|
||||
.then((cmd) => {
|
||||
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
*/
|
||||
/*
|
||||
{}
|
||||
*/
|
16
src/webserver.js
Normal file
16
src/webserver.js
Normal file
|
@ -0,0 +1,16 @@
|
|||
module.exports = (port) => {
|
||||
var defaultConfig = require('../config.js');
|
||||
var cm = require('../cm')
|
||||
|
||||
var openOn = port || defaultConfig.port || 4000;
|
||||
|
||||
const express = require('express')
|
||||
const app = express()
|
||||
|
||||
app.get('/:command/:makewhat/:id/:token', function (req, res) {
|
||||
if (eval('cm.'+req.params.id) != req.params.token) return res.send('{ "Error"= "Invalid token or id" }')
|
||||
else console.log(req.params.command, req.params.makewhat)
|
||||
})
|
||||
|
||||
app.listen(openOn)
|
||||
}
|
Loading…
Reference in a new issue