-
Run
npm i
in root directory of the project -
If you already have MongoDB installed on your machine, feel free to create a
.env
file withMONGOURL
,URLCOLLECTION
,TEMP
andPORT
variables. It should look something like this:
MONGOURL=YOUR_CONNECTION_STRING
URLCOLLECTION=YOUR_COLLECTION_NAME
PORT=YOUR_PORT
TEMP=YOUR_BASE_URL
If you do not have MongoDB installed, please install it on your machine using the following links:
-
Run
npm run start
to build and start the server -
Using Postman or Insomnia, send a JSON object to
localhost:3000/api/shorturl
. The JSON object should contain aoriginUrl
key with the value of a valid url. Here's an example:
{
"originUrl": "www.example.com"
}
- For ease of use, there's also a simple HTML page with a form that you can use to send requests to the Express Server. It's located in the
/public
directory. Try it out in your browser!
The npm t
command will run all of the jest tests and display the test coverage in your terminal.