This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* creates a command group and adds to `CMD+K` menu | |
* - make sure the command groups, and commands get **unique** keys | |
* - if commandGroup doesn't contains commands the group will be **removed** | |
* - for the command shortcuts to work you need to pass the output of this command to `useKeyMap` | |
* to handle the shortcuts | |
* | |
* @example | |
* ```ts | |
* { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
app.get('/create/:username',function (req, res) { | |
User | |
.create({ | |
name: req.params['username'] | |
}) | |
.exec(function(err, user) { | |
if(err || user == null) { | |
res.send(err); | |
} else { | |
res.send({user}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
app.get('/delete/:user', async function (req, res) { | |
try { | |
let isModified = await User.remove({name: req.params['user']}); | |
res.send(isModified); | |
} catch (err) { | |
res.send(err); | |
} | |
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
app.get('/update/:from/:to', async function (req, res) { | |
try { | |
let user = await User.findOne({name: req.params['from']}); | |
user.name = req.params['to']; | |
let isModified = await User.update({name: req.params['from']}, user); | |
res.send(isModified); | |
} catch (err) { | |
res.send(err); | |
} | |
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
app.get('/create/:username', async function (req, res) { | |
let create; | |
try { | |
create = await User.create({name: req.params['username']}); | |
} catch (err) { | |
res.send(err); | |
} | |
res.send(create); | |
}) |