mirror of
https://github.com/LukasKanka/api_test.git
synced 2026-11-11 06:34:36 +01:00
refactor: restructure to monorepo with backends and apiTest
- Move web/backend to backends/potter-api - Move web/frontend to backends/potter-api/frontend - Add root package.json with npm workspaces - Update README.md with monorepo navigation - Update .github/workflows/api-tests.yml for dynamic test discovery - Update bruno_test_scenario.md paths - Fix .gitignore to allow JSON data files - Add three new AI tests in apiTest/PotterAPI/AI/ Generated by Mistral Vibe. Co-Authored-By: Mistral Vibe <vibe@mistral.ai>
This commit is contained in:
1 parent
2e185b47ef
commit
d0cdabbf11
57 files changed
+292
-35
No files matched your search
@@ -0,0 +1,21 @@
|
||||
const express = require('express');
|
||||
const router = express.Router();
|
||||
const charactersController = require('../controllers/charactersController.js');
|
||||
var basicAuth = require('express-basic-auth');
|
||||
|
||||
router.use(basicAuth({
|
||||
users: { 'admin': 'supersecret' },
|
||||
unauthorizedResponse: {
|
||||
message: "Sorry Wizard, can't let you in."
|
||||
}
|
||||
}));
|
||||
|
||||
router.get('/', charactersController.characters_list);
|
||||
router.post('/', charactersController.new_character);
|
||||
router.delete('/actions/deleteAll', charactersController.delete_all);
|
||||
router.get('/actions/reset', charactersController.reset);
|
||||
router.get('/:characterId', charactersController.specific_character);
|
||||
router.delete('/:characterId', charactersController.delete_character);
|
||||
router.put('/:characterId', charactersController.update_character);
|
||||
|
||||
module.exports = router;
|
||||
@@ -0,0 +1,13 @@
|
||||
const express = require('express');
|
||||
const router = express.Router();
|
||||
const houseController = require('../controllers/housesController.js')
|
||||
module.exports = router;
|
||||
const verifyToken = require('../app.js');
|
||||
const checkToken = require('../middleware/auth.js');
|
||||
|
||||
router.use(verifyToken, checkToken);
|
||||
|
||||
router.get('/', houseController.houses_list);
|
||||
|
||||
router.get('/:houseId', houseController.specific_house)
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
const express = require('express');
|
||||
const router = express.Router();
|
||||
module.exports = router;
|
||||
const quotes = require('../quotes.json')
|
||||
|
||||
function getRandomQuote() {
|
||||
return quotes[Math.floor(Math.random() * quotes.length)];
|
||||
}
|
||||
|
||||
router.get('/', function (req, res) {
|
||||
res.json(getRandomQuote())
|
||||
});
|
||||
@@ -0,0 +1,25 @@
|
||||
const express = require('express');
|
||||
const router = express.Router();
|
||||
module.exports = router;
|
||||
const houses = require('../houses.json')
|
||||
const sortingHatQuotes = require('../sortinghatquotes.json')
|
||||
|
||||
function getRandomHouseName() {
|
||||
let houseNames = houses.map(house => house.name);
|
||||
return houseNames[Math.floor(Math.random() * houseNames.length)];
|
||||
}
|
||||
|
||||
function getRandomQuote() {
|
||||
return sortingHatQuotes[Math.floor(Math.random() * sortingHatQuotes.length)];
|
||||
}
|
||||
|
||||
router.get('/', function (req, res) {
|
||||
let house = getRandomHouseName();
|
||||
setTimeout(() => {
|
||||
return res.json({
|
||||
sortingHatSays: getRandomQuote() + ' ' + house,
|
||||
house: house
|
||||
})
|
||||
}, 500)
|
||||
|
||||
});
|
||||
@@ -0,0 +1,23 @@
|
||||
const express = require('express');
|
||||
const router = express.Router();
|
||||
const spells = require('../spells.json');
|
||||
const spellController = require('../controllers/spellsController.js')
|
||||
module.exports = router;
|
||||
const authChecker = require('../middleware/header.js')
|
||||
|
||||
router.get('/', spellController.spells_list);
|
||||
|
||||
router.post('/', authChecker.checkHeader, spellController.new_spell);
|
||||
|
||||
router.get('/:spellId', spellController.specific_spell)
|
||||
|
||||
router.delete('/:spellId', spellController.delete_spell)
|
||||
|
||||
router.delete('/actions/deleteAll', spellController.delete_all)
|
||||
|
||||
router.get('/actions/reset', spellController.reset)
|
||||
|
||||
router.put('/:spellId', authChecker.checkHeader, spellController.update_spell)
|
||||
|
||||
|
||||
|
||||
Reference in new issue
Block a user