mirror of
https://github.com/Retropex/apolloapi-v2.git
synced 2025-05-28 13:02:35 +02:00
Add NodeStart.js and NodeStop.js
This commit is contained in:
parent
72166d170b
commit
6e1944a872
13
src/graphql/graphqlModules/Node/NodeStart.js
Normal file
13
src/graphql/graphqlModules/Node/NodeStart.js
Normal file
@ -0,0 +1,13 @@
|
||||
module.exports.typeDefs = `
|
||||
type NodeActions {
|
||||
start: EmptyOutput!
|
||||
}
|
||||
`;
|
||||
|
||||
module.exports.resolvers = {
|
||||
NodeActions: {
|
||||
start (root, args, { dispatch }) {
|
||||
return dispatch('api/node/start');
|
||||
}
|
||||
}
|
||||
};
|
13
src/graphql/graphqlModules/Node/NodeStop.js
Normal file
13
src/graphql/graphqlModules/Node/NodeStop.js
Normal file
@ -0,0 +1,13 @@
|
||||
module.exports.typeDefs = `
|
||||
type NodeActions {
|
||||
stop: EmptyOutput!
|
||||
}
|
||||
`;
|
||||
|
||||
module.exports.resolvers = {
|
||||
NodeActions: {
|
||||
stop (root, args, { dispatch }) {
|
||||
return dispatch('api/node/stop');
|
||||
}
|
||||
}
|
||||
};
|
8
src/store/api/node/nodeStart.js
Normal file
8
src/store/api/node/nodeStart.js
Normal file
@ -0,0 +1,8 @@
|
||||
const { exec } = require('child_process')
|
||||
|
||||
module.exports = ({ define }) => {
|
||||
define('start', async (payload, { knex, errors, utils }) => {
|
||||
exec('sudo systemctl start node')
|
||||
},
|
||||
{ auth: true })
|
||||
}
|
8
src/store/api/node/nodeStop.js
Normal file
8
src/store/api/node/nodeStop.js
Normal file
@ -0,0 +1,8 @@
|
||||
const { exec } = require('child_process')
|
||||
|
||||
module.exports = ({ define }) => {
|
||||
define('stop', async (payload, { knex, errors, utils }) => {
|
||||
exec('sudo systemctl stop node')
|
||||
},
|
||||
{ auth: true })
|
||||
}
|
Loading…
Reference in New Issue
Block a user