88 */
99
1010import * as express from 'express' ;
11- import { my } from 'my-express' ;
11+ import { myExpress } from 'my-express' ;
1212
1313
14- export const extendExpressResponse = ( req : my . Request , res : my . Response , next : express . NextFunction ) => {
14+ export const extendExpressResponse = ( req : myExpress . Request , res : myExpress . Response , next : express . NextFunction ) => {
1515
1616 /**
1717 * 200 - OK
1818 * This is used for successful responses and a json body
1919 */
20- res . ok = < T > ( data : T , options : my . ResponseOptions = { } ) => {
20+ res . ok = < T > ( data : T , options : myExpress . ResponseOptions = { } ) => {
2121 res . status ( 200 ) ;
2222 return res . json ( bodySuccessful ( data , options ) ) ;
2323 } ;
@@ -26,7 +26,7 @@ export const extendExpressResponse = (req: my.Request, res: my.Response, next: e
2626 * 201 - Created
2727 * This is used for created resources
2828 */
29- res . created = < T > ( data : T , options : my . ResponseOptions = { } ) => {
29+ res . created = < T > ( data : T , options : myExpress . ResponseOptions = { } ) => {
3030 res . status ( 201 ) ;
3131 return res . json ( bodySuccessful ( data , options ) ) ;
3232 } ;
@@ -35,23 +35,23 @@ export const extendExpressResponse = (req: my.Request, res: my.Response, next: e
3535 * 200 - Found
3636 * Like the ok function
3737 */
38- res . found = < T > ( data : T , options : my . ResponseOptions = { } ) => {
38+ res . found = < T > ( data : T , options : myExpress . ResponseOptions = { } ) => {
3939 return res . ok ( data , options ) ;
4040 } ;
4141
4242 /**
4343 * 200 - Updated
4444 * Like the ok function
4545 */
46- res . updated = < T > ( data : T , options : my . ResponseOptions = { } ) => {
46+ res . updated = < T > ( data : T , options : myExpress . ResponseOptions = { } ) => {
4747 return res . ok ( data , options ) ;
4848 } ;
4949
5050 /**
5151 * 200 - Destroyed
5252 * This is the response after a resource has been removed
5353 */
54- res . destroyed = ( options : my . ResponseOptions = { } ) => {
54+ res . destroyed = ( options : myExpress . ResponseOptions = { } ) => {
5555 res . status ( 200 ) ;
5656 return res . json ( bodySuccessful ( null ) ) ;
5757 } ;
@@ -72,7 +72,7 @@ export const extendExpressResponse = (req: my.Request, res: my.Response, next: e
7272/**
7373 * This body parser is used to show successful responses to the client
7474 */
75- export function bodySuccessful < T > ( data : T , options : my . ResponseOptions = { } ) : any {
75+ export function bodySuccessful < T > ( data : T , options : myExpress . ResponseOptions = { } ) : any {
7676 return {
7777 success : true ,
7878 ...message ( options . message ) ,
@@ -100,7 +100,7 @@ function message(value?: string): any {
100100 return ;
101101}
102102
103- function links ( values ?: my . ResponseLinks [ ] ) : any {
103+ function links ( values ?: myExpress . ResponseLinks [ ] ) : any {
104104 if ( values ) {
105105 return { links : values } ;
106106 }
0 commit comments