Feedback Please: URL Shortener Microservice

I’ve just finished the URL Shortener Microservice project.

I’m using MongoDB (MongoDB Atlas) as key/value store with mongoose.
I managed to implement some requested features.

But this project has no test script.
(I can pass this test without any code because the project test case is empty… )

I’m not sure if my code is correct, so please give me feedback or comments.

Especially, I still have not understood well about async / await / Promise.

  • Main source code

    • project_3.js (Using Express)
  • POST

    • Get the url from request parameter
    • Parse this url such as protocol, hostname, parameter…(using url.parse())
    • Confirm the hostname is valid (using dns.resolve())
    • Find the record already exists
    • Create new record into MongoDB (via mangoose)
    • Add sequence number with using mongoose-sequence
  • GET

    • Find the record via ID
    • Redirect to the original url (res.redirect())