-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add fixture CRUD routes and controller
- Loading branch information
Showing
3 changed files
with
59 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
const https = require('https'); | ||
const Standing = require('../models/fixture'); | ||
require("dotenv").config(); | ||
const mockData = require('../mock/fixturesData.json'); | ||
|
||
exports.createFixture = async (req, res) => { | ||
const { code } = req.params; | ||
return res.status(201).json({ | ||
success: true, | ||
competition: code, | ||
result: 'work in progress' | ||
}); | ||
}; | ||
|
||
exports.findFixtureByCompetitionCode = async (req, res) => { | ||
const { code } = req.params; | ||
return res.status(201).json({ | ||
success: true, | ||
competition: code, | ||
result: 'work in progress' | ||
}); | ||
}; | ||
|
||
exports.updateFixtureByCompetitionCode = async (req, res) => { | ||
const { code } = req.params; | ||
return res.status(201).json({ | ||
success: true, | ||
competition: code, | ||
result: 'work in progress' | ||
}); | ||
}; | ||
|
||
exports.deleteFixtureByCompetitionCode = async (req, res) => { | ||
const { code } = req.params; | ||
return res.status(201).json({ | ||
success: true, | ||
competition: code, | ||
result: 'work in progress' | ||
}); | ||
}; |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
const express = require('express'); | ||
|
||
const router = express.Router(); | ||
|
||
const { | ||
createFixture, | ||
findFixtureByCompetitionCode, | ||
updateFixtureByCompetitionCode, | ||
deleteFixtureByCompetitionCode | ||
} = require('../controllers/fixtureController'); | ||
|
||
router.post('/:code', createFixture); | ||
router.get('/:code', findFixtureByCompetitionCode); | ||
router.put('/:code', updateFixtureByCompetitionCode); | ||
router.delete('/:code', deleteFixtureByCompetitionCode); | ||
|
||
module.exports = router; |
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