Last active
July 29, 2018 04:29
-
-
Save thihenos/accbf3c73258fb380d57899112c95090 to your computer and use it in GitHub Desktop.
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
'use strict'; | |
module.exports = function (app) { | |
//getting the file which has all the routes to save any materials | |
let material = require('./routes/material'); | |
app.get('/material/new',material.new); | |
app.get('/material',material.findAll); | |
app.get('/material/:id',material.find); | |
app.post('/material',material.create); | |
app.post('/material/:id',material.update); | |
app.delete('/material/:id',material.destroy); | |
/* If the user tries to access any address of the app which not exists in routes.js file, | |
* it will be send to the show page, which will return all data saved | |
*/ | |
app.route('/*').get(function (req, res) { | |
res.render('material/show'); | |
}); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment