UNPKG

yahoi

Version:

Yet Another Highly Opinionated Isomorphic Framework

24 lines (19 loc) 456 B
import ControllerResponseType from './../ControllerResponseType'; export default class Redirect extends ControllerResponseType { constructor(props1, props2) { if(typeof(props1)=='string') { super(props2); this.url = props1; } else { super(props1); this.url = props1.to; } } respond(req, res) { try { res.redirect(this.url); } catch(e) { res.send('error: ' + String(e)); } } }