我想做一些更大的不和谐机器人。我知道如何制作一个机器人和所有的东西,但我想知道如何制作一个网页面板。有人能解释一下如何制作其中一个并与机器人集成吗?
发布于 2019-10-18 01:24:08
在你的node discord机器人中使用express.js查看Express获取更深入的例子。如果你想了解套接字连接,Socket.io有关于构建套接字连接应用的很好的教程。我更喜欢在Angular中构建节点应用程序的前端
const bodyParser = require('body-parser');
const app = require('express')();
// these are for parsing POST requests
// alternatively you can use socket.io for real time communication
// but POST'sshould suffice
app.use(bodyParser.urlencoded({ extended: false }))
app.use(bodyParser.json())
// GET requests like this first argument is url
// example; '*': all; '/home', '/something'
app.get('*', (req,res)=>{ /* process get request */ });
// POST requests
app.post('*', post.process);
// listen on your port eg: 80
http.listen(port, ()=>{
console.log('Listening on port: '+port);
})https://stackoverflow.com/questions/58437206
复制相似问题