URL Shortener Project Feedback

Hi! I just wanted some feedback on my solution to the APIs and Microservices challenge URL Shortener Microservice.

My glitch url is https://perpetual-scourge-2.glitch.me/
My github is https://github.com/SunshineMccoy/freeCodeCampURLShortener

It seems to pass all of the user stories to me, but it isn’t passing the tests on this site I found here in the forums: https://narrow-plane.glitch.me/

Let me know if it seems to work or if there are any problems!

I put in bestbuy.com, got shorturl: 97.

When I tried to use the shorturl I got

CastError: Cast to number failed for value "Bestbuy.com" at path "new" for model "Url"
    at new CastError (/rbd/pnpm-volume/fc2df73d-9cd2-4cb2-a085-f04f97f64815/node_modules/.registry.npmjs.org/mongoose/5.6.5/node_modules/mongoose/lib/error/cast.js:29:11)
    at SchemaNumber.cast (/rbd/pnpm-volume/fc2df73d-9cd2-4cb2-a085-f04f97f64815/node_modules/.registry.npmjs.org/mongoose/5.6.5/node_modules/mongoose/lib/schema/number.js:313:11)
    at SchemaNumber.SchemaType.applySetters (/rbd/pnpm-volume/fc2df73d-9cd2-4cb2-a085-f04f97f64815/node_modules/.registry.npmjs.org/mongoose/5.6.5/node_modules/mongoose/lib/schematype.js:948:12)
    at SchemaNumber.SchemaType._castForQuery (/rbd/pnpm-volume/fc2df73d-9cd2-4cb2-a085-f04f97f64815/node_modules/.registry.npmjs.org/mongoose/5.6.5/node_modules/mongoose/lib/schematype.js:1362:15)
    at SchemaNumber.castForQuery (/rbd/pnpm-volume/fc2df73d-9cd2-4cb2-a085-f04f97f64815/node_modules/.registry.npmjs.org/mongoose/5.6.5/node_modules/mongoose/lib/schema/number.js:365:14)
    at SchemaNumber.SchemaType.castForQueryWrapper (/rbd/pnpm-volume/fc2df73d-9cd2-4cb2-a085-f04f97f64815/node_modules/.registry.npmjs.org/mongoose/5.6.5/node_modules/mongoose/lib/schematype.js:1331:15)
    at cast (/rbd/pnpm-volume/fc2df73d-9cd2-4cb2-a085-f04f97f64815/node_modules/.registry.npmjs.org/mongoose/5.6.5/node_modules/mongoose/lib/cast.js:307:32)
    at model.Query.Query.cast (/rbd/pnpm-volume/fc2df73d-9cd2-4cb2-a085-f04f97f64815/node_modules/.registry.npmjs.org/mongoose/5.6.5/node_modules/mongoose/lib/query.js:4576:12)
    at model.Query.Query._castConditions (/rbd/pnpm-volume/fc2df73d-9cd2-4cb2-a085-f04f97f64815/node_modules/.registry.npmjs.org/mongoose/5.6.5/node_modules/mongoose/lib/query.js:1783:10)
    at model.Query.<anonymous> (/rbd/pnpm-volume/fc2df73d-9cd2-4cb2-a085-f04f97f64815/node_modules/.registry.npmjs.org/mongoose/5.6.5/node_modules/mongoose/lib/query.js:2038:8)
    at model.Query._wrappedThunk [as _findOne] (/rbd/pnpm-volume/fc2df73d-9cd2-4cb2-a085-f04f97f64815/node_modules/.registry.npmjs.org/mongoose/5.6.5/node_modules/mongoose/lib/helpers/query/wrapThunk.js:16:8)
    at process.nextTick (/rbd/pnpm-volume/fc2df73d-9cd2-4cb2-a085-f04f97f64815/node_modules/.registry.npmjs.org/kareem/2.3.0/node_modules/kareem/index.js:369:33)
    at process._tickCallback (internal/process/next_tick.js:61:11)

Thank you for the feedback! I had only thought to test it with URLs that started with ‘https://’ and didn’t realize res.redirect() would do relative redirects. I’ve fixed that now.