Skip to content

Instantly share code, notes, and snippets.

@thihenos
Last active July 29, 2018 04:29
Show Gist options
  • Save thihenos/accbf3c73258fb380d57899112c95090 to your computer and use it in GitHub Desktop.
Save thihenos/accbf3c73258fb380d57899112c95090 to your computer and use it in GitHub Desktop.
'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