Upload main code

This commit is contained in:
Wessel Damian Tip
2019-01-16 17:06:03 +01:00
parent 81274e83c3
commit ad36e794a8
11 changed files with 301 additions and 0 deletions

16
model/KirbeRequest.js Normal file
View File

@@ -0,0 +1,16 @@
const { parse } = require( 'url' );
module.exports = class KirbeRequest {
constructor( req, body ) {
this.url = req.url;
this.req = req;
this.body = body;
this.from = req.connection.remoteAddress;
this.method = req.method;
this.headers = req.headers;
this.parsedUrl = parse( this.url, true );
}
json() { return JSON.parse( this.body ); }
query ( name ) { return this.parsedUrl.query[ name ]; }
};