Test
This commit is contained in:
parent
5fba7b1699
commit
04bf2c46b5
3 changed files with 3 additions and 34 deletions
2
cm.js
2
cm.js
|
@ -1,3 +1,3 @@
|
||||||
module.exports = {
|
module.exports = {
|
||||||
'0': 'HelloWorld'
|
'cc': 'helloworld'
|
||||||
}
|
}
|
33
index.js
33
index.js
|
@ -1,32 +1 @@
|
||||||
var colors = require('colors');
|
require('./src/webserver')()
|
||||||
var readlineSync = require('readline-sync');
|
|
||||||
var server = require('./src/server.js');
|
|
||||||
server('gui')
|
|
||||||
|
|
||||||
class mitdb {
|
|
||||||
/**
|
|
||||||
* @constructor
|
|
||||||
* @param type This can be 'client' or 'server'
|
|
||||||
* @param link If type = client, this is the server address (with the port), if type = server, this is the port
|
|
||||||
* @example (client) http://0.0.0.0:12934
|
|
||||||
* @example (server) 12934
|
|
||||||
*/
|
|
||||||
|
|
||||||
constructor (type, link) {
|
|
||||||
this.type = type;
|
|
||||||
this.link = link;
|
|
||||||
if (type == 'client') {
|
|
||||||
|
|
||||||
} else if (type == 'server') {
|
|
||||||
server('api')
|
|
||||||
} else {
|
|
||||||
throw new Error('Type is required')
|
|
||||||
}
|
|
||||||
}
|
|
||||||
server
|
|
||||||
}
|
|
||||||
|
|
||||||
module.export = mitdb
|
|
||||||
/*
|
|
||||||
{}
|
|
||||||
*/
|
|
|
@ -9,7 +9,7 @@ module.exports = (port) => {
|
||||||
|
|
||||||
app.get('/:command/:makewhat/:id/:token', function (req, res) {
|
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" }')
|
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)
|
else console.log(req.params.command, req.params.makewhat, req.body)
|
||||||
})
|
})
|
||||||
|
|
||||||
app.listen(openOn)
|
app.listen(openOn)
|
||||||
|
|
Loading…
Reference in a new issue