11"use strict" ;
2+ var __createBinding = ( this && this . __createBinding ) || ( Object . create ? ( function ( o , m , k , k2 ) {
3+ if ( k2 === undefined ) k2 = k ;
4+ var desc = Object . getOwnPropertyDescriptor ( m , k ) ;
5+ if ( ! desc || ( "get" in desc ? ! m . __esModule : desc . writable || desc . configurable ) ) {
6+ desc = { enumerable : true , get : function ( ) { return m [ k ] ; } } ;
7+ }
8+ Object . defineProperty ( o , k2 , desc ) ;
9+ } ) : ( function ( o , m , k , k2 ) {
10+ if ( k2 === undefined ) k2 = k ;
11+ o [ k2 ] = m [ k ] ;
12+ } ) ) ;
13+ var __setModuleDefault = ( this && this . __setModuleDefault ) || ( Object . create ? ( function ( o , v ) {
14+ Object . defineProperty ( o , "default" , { enumerable : true , value : v } ) ;
15+ } ) : function ( o , v ) {
16+ o [ "default" ] = v ;
17+ } ) ;
218var __importStar = ( this && this . __importStar ) || function ( mod ) {
319 if ( mod && mod . __esModule ) return mod ;
420 var result = { } ;
5- if ( mod != null ) for ( var k in mod ) if ( Object . hasOwnProperty . call ( mod , k ) ) result [ k ] = mod [ k ] ;
6- result [ "default" ] = mod ;
21+ if ( mod != null ) for ( var k in mod ) if ( k !== "default" && Object . prototype . hasOwnProperty . call ( mod , k ) ) __createBinding ( result , mod , k ) ;
22+ __setModuleDefault ( result , mod ) ;
723 return result ;
824} ;
925var __importDefault = ( this && this . __importDefault ) || function ( mod ) {
@@ -17,25 +33,25 @@ class Router {
1733 constructor ( server ) {
1834 const router = express . Router ( ) ;
1935 const cats = new Map ( ) ;
20- cats [ uuid_1 . v4 ( ) ] = { genus : "feline" , name : "Cosmo" , isHungry : true , lastFedDate : new Date ( ) } ;
21- cats [ uuid_1 . v4 ( ) ] = { genus : "feline" , name : "Emmy" , isHungry : true , lastFedDate : new Date ( ) } ;
36+ cats [ ( 0 , uuid_1 . v4 ) ( ) ] = { genus : "feline" , name : "Cosmo" , isHungry : true , lastFedDate : new Date ( ) } ;
37+ cats [ ( 0 , uuid_1 . v4 ) ( ) ] = { genus : "feline" , name : "Emmy" , isHungry : true , lastFedDate : new Date ( ) } ;
2238 router . get ( '/' , ( req , res ) => {
2339 res . json ( {
2440 message : `Nothing to see here, [url]/cats instead.`
2541 } ) ;
2642 } ) ;
2743 //get all cats
28- router . get ( '/cats' , cors_1 . default ( ) , ( req , res ) => {
44+ router . get ( '/cats' , ( 0 , cors_1 . default ) ( ) , ( req , res ) => {
2945 res . json ( {
3046 cats
3147 } ) ;
3248 } ) ;
3349 //create new cat
34- router . post ( '/cats' , cors_1 . default ( ) , ( req , res ) => {
50+ router . post ( '/cats' , ( 0 , cors_1 . default ) ( ) , ( req , res ) => {
3551 try {
3652 let cat = { } ;
3753 Object . assign ( cat , req . body ) ;
38- const newUUID = uuid_1 . v4 ( ) ;
54+ const newUUID = ( 0 , uuid_1 . v4 ) ( ) ;
3955 cats [ newUUID ] = cat ;
4056 res . json ( {
4157 uuid : newUUID
@@ -46,7 +62,7 @@ class Router {
4662 }
4763 } ) ;
4864 //get cat by id
49- router . get ( '/cats/:id' , cors_1 . default ( ) , ( req , res ) => {
65+ router . get ( '/cats/:id' , ( 0 , cors_1 . default ) ( ) , ( req , res ) => {
5066 if ( ! ! cats [ req . params . id ] ) {
5167 res . json ( {
5268 cat : cats [ req . params . id ]
@@ -57,7 +73,7 @@ class Router {
5773 }
5874 } ) ;
5975 //update cat
60- router . put ( '/cats/:id' , cors_1 . default ( ) , ( req , res ) => {
76+ router . put ( '/cats/:id' , ( 0 , cors_1 . default ) ( ) , ( req , res ) => {
6177 try {
6278 if ( ! ! cats [ req . params . id ] ) {
6379 let cat = { } ;
@@ -76,7 +92,7 @@ class Router {
7692 }
7793 } ) ;
7894 //delete cat
79- router . delete ( '/cats/:id' , cors_1 . default ( ) , ( req , res ) => {
95+ router . delete ( '/cats/:id' , ( 0 , cors_1 . default ) ( ) , ( req , res ) => {
8096 if ( ! ! cats [ req . params . id ] ) {
8197 delete cats [ req . params . id ] ;
8298 res . json ( {
@@ -87,7 +103,7 @@ class Router {
87103 res . status ( 404 ) . send ( JSON . stringify ( { "error" : "no such cat" } ) ) ;
88104 }
89105 } ) ;
90- router . options ( '*' , cors_1 . default ( ) ) ;
106+ router . options ( '*' , ( 0 , cors_1 . default ) ( ) ) ;
91107 server . use ( '/' , router ) ;
92108 }
93109}
0 commit comments