Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
module.exports = (function() {
'use strict';
const Nodal = require('nodal');
const crypto = require('crypto');
const fs = require('fs');
const Error404Controller = Nodal.require('app/controllers/error/404_controller.js');
class StaticController extends Nodal.Controller {
get() {
let filepath = this.params.matches[0];
let ext = filepath.substr(filepath.lastIndexOf('.') + 1);
filepath = filepath.replace(/(\.){1,2}\//gi, '');
fs.readFile(`./static/${filepath}`, (err, buffer) => {
if (err) {
return Error404Controller.prototype.get.call(this);
}
this.setHeader('Content-Type', Nodal.Mime.lookup(ext) || 'application/octet-stream');
if (this.getHeader('Content-Type').split(';')[0].split('/')[0] === 'video') {
'use strict';
const Nodal = require('nodal');
class AuthController extends Nodal.Controller {
authorize(callback) {
this.setHeader('Cache-Control', 'no-store');
this.setHeader('Pragma', 'no-cache');
callback(null);
}
}
module.exports = AuthController;
module.exports = (function() {
"use strict";
const Nodal = require('nodal');
class Error404Controller extends Nodal.Controller {
get() {
this.status(404);
this.render(
Nodal.Template.generate('error/404.html').render(this.params)
);
}
}
return Error404Controller;
})();
'use strict';
const Nodal = require('nodal');
class IndexController extends Nodal.Controller {
get() {
this.respond({message: 'Welcome to your Nodal Project'});
}
}
module.exports = IndexController;