diff --git a/bin/start.js b/bin/start.js new file mode 100644 index 0000000..908ba84 --- /dev/null +++ b/bin/start.js @@ -0,0 +1 @@ +#!/usr/bin/env node diff --git a/cm.js b/cm.js new file mode 100644 index 0000000..4c34a57 --- /dev/null +++ b/cm.js @@ -0,0 +1,3 @@ +module.exports = { + '0': 'HelloWorld' +} \ No newline at end of file diff --git a/config.js b/config.js new file mode 100644 index 0000000..45c25c6 --- /dev/null +++ b/config.js @@ -0,0 +1,3 @@ +module.exports = { + port: 4000 +} \ No newline at end of file diff --git a/package.json b/package.json index 4c19781..00918e9 100644 --- a/package.json +++ b/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" } } diff --git a/src/server.js b/src/server.js deleted file mode 100644 index 4317fe6..0000000 --- a/src/server.js +++ /dev/null @@ -1,14 +0,0 @@ -/*module.exports = function (interface) { - if (interface == 'gui') { - async function home() { - std.cin('MitDB >'.red) - .then((cmd) => { - - }) - } - } -} -*/ -/* -{} -*/ \ No newline at end of file diff --git a/src/webserver.js b/src/webserver.js new file mode 100644 index 0000000..485d60d --- /dev/null +++ b/src/webserver.js @@ -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) +} \ No newline at end of file