Skip to content

Commit

Permalink
Applications controller and routes blueprint
Browse files Browse the repository at this point in the history
  • Loading branch information
StanleyMasinde committed May 11, 2021
1 parent 94677d7 commit 40e8609
Show file tree
Hide file tree
Showing 3 changed files with 69 additions and 0 deletions.
2 changes: 2 additions & 0 deletions backend/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ const logger = require('morgan')
const indexRouter = require('./routes/index')
const usersRouter = require('./routes/users')
const authRouter = require('./routes/auth')
const appsRouter = require('./routes/applications')

const app = express()

Expand All @@ -33,5 +34,6 @@ app.use(cookieParser())
app.use('/', indexRouter)
app.use('/users', usersRouter)
app.use('/auth', authRouter)
app.use('/applications', appsRouter)

module.exports = app
33 changes: 33 additions & 0 deletions backend/app/controllers/applicationController.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
const Controller = require('./controller')

class ApplicationController extends Controller {
/**
* Show all the applications. (15 per page)
* @param {import('express').Request} req
* @param {import('express').Response} res
*/
index(req, res) {}

/**
* Show an application with a given ID
* @param {import('express').Request} req
* @param {import('express').Response} res
*/
show(req, res) {}

/**
* Update information about a particular event
* @param {import('express').Request} req
* @param {import('express').Response} res
*/
update(req, res) {}

/**
* Delete an application from the database
* @param {import('express').Request} req
* @param {import('express').Response} res
*/
delete(req, res) {}
}

module.exports = new ApplicationController()
34 changes: 34 additions & 0 deletions backend/routes/applications.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
const router = require('express').Router()

/**
* Load all the applications from the database.
* The default result count is 15 per page
*/
router.get('/', (req, res) => {})

/**
* Create a new application and return it with
* a 201 response
*/
router.post('/', (req, res) => {})

/**
* Get a application using it's database ID
* A 404 response is returned if the application was
* Not found in the database
*/
router.get('/:id', (req, res) => {})

/**
* Update an application's information.
* Returns 201 on success
*/
router.put('/:id', (req, res) => {})

/**
* Deletes an application from the database
* A 200 response is returned on success
*/
router.delete('/', (req, res) => {})

module.exports = router

0 comments on commit 40e8609

Please sign in to comment.