Support router in server plugin

This commit is contained in:
Chocobozzz 2020-04-10 14:42:34 +02:00
parent 2a43a487c2
commit 82fd4f7414
No known key found for this signature in database
GPG Key ID: 583A612D890159BE

View File

@ -1,5 +1,6 @@
async function register ({
registerHook,
getRouter,
registerSetting,
settingsManager,
storageManager,
@ -51,6 +52,10 @@ async function register ({
console.log(value)
await storageManager.storeData('toto', 'hello' + new Date())
await storageManager.storeData('toto2', { toto2: [ 'user 1', 'user 2' ] })
console.log(await storageManager.getData('toto2'))
console.log(await storageManager.getData('toto2.toto2'))
videoLanguageManager.addLanguage('al_bhed', 'Al Bhed')
videoLanguageManager.deleteLanguage('fr')
@ -60,6 +65,13 @@ async function register ({
videoLicenceManager.addLicence(42, 'Best licence')
videoLicenceManager.deleteLicence(7) // Public domain
const router = getRouter()
router.get('/ping', (req, res) => res.json({ message: 'pong' }))
router.post('/form/post/mirror', (req, res) => {
res.json(req.body)
})
}
async function unregister () {