Skip to content

Commit 40e8609

Browse files
Applications controller and routes blueprint
1 parent 94677d7 commit 40e8609

File tree

3 files changed

+69
-0
lines changed

3 files changed

+69
-0
lines changed

backend/app.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ const logger = require('morgan')
77
const indexRouter = require('./routes/index')
88
const usersRouter = require('./routes/users')
99
const authRouter = require('./routes/auth')
10+
const appsRouter = require('./routes/applications')
1011

1112
const app = express()
1213

@@ -33,5 +34,6 @@ app.use(cookieParser())
3334
app.use('/', indexRouter)
3435
app.use('/users', usersRouter)
3536
app.use('/auth', authRouter)
37+
app.use('/applications', appsRouter)
3638

3739
module.exports = app
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
const Controller = require('./controller')
2+
3+
class ApplicationController extends Controller {
4+
/**
5+
* Show all the applications. (15 per page)
6+
* @param {import('express').Request} req
7+
* @param {import('express').Response} res
8+
*/
9+
index(req, res) {}
10+
11+
/**
12+
* Show an application with a given ID
13+
* @param {import('express').Request} req
14+
* @param {import('express').Response} res
15+
*/
16+
show(req, res) {}
17+
18+
/**
19+
* Update information about a particular event
20+
* @param {import('express').Request} req
21+
* @param {import('express').Response} res
22+
*/
23+
update(req, res) {}
24+
25+
/**
26+
* Delete an application from the database
27+
* @param {import('express').Request} req
28+
* @param {import('express').Response} res
29+
*/
30+
delete(req, res) {}
31+
}
32+
33+
module.exports = new ApplicationController()

backend/routes/applications.js

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
const router = require('express').Router()
2+
3+
/**
4+
* Load all the applications from the database.
5+
* The default result count is 15 per page
6+
*/
7+
router.get('/', (req, res) => {})
8+
9+
/**
10+
* Create a new application and return it with
11+
* a 201 response
12+
*/
13+
router.post('/', (req, res) => {})
14+
15+
/**
16+
* Get a application using it's database ID
17+
* A 404 response is returned if the application was
18+
* Not found in the database
19+
*/
20+
router.get('/:id', (req, res) => {})
21+
22+
/**
23+
* Update an application's information.
24+
* Returns 201 on success
25+
*/
26+
router.put('/:id', (req, res) => {})
27+
28+
/**
29+
* Deletes an application from the database
30+
* A 200 response is returned on success
31+
*/
32+
router.delete('/', (req, res) => {})
33+
34+
module.exports = router

0 commit comments

Comments
 (0)