A Nest based url shortener written in TypeScript and leveraging MongoDB for storage.
-
POST: http://localhost:3000/create-url
Payload:
{ "longUrl": "https://www.linkedin.com/in/christophermilian/" }
- Must be entered in a browser for proper redirection
$ npm install
# development
$ npm run start
# watch mode
$ npm run start:dev
# production mode
$ npm run start:prod
# Install MongoDB via Homebrew
brew tap mongodb/brew
# Update brew packages
brew update
# Install mongodb
brew install mongodb-community@7.0
Before running mongosh, you need to create an admin user to secure the connection. Steps for creating an admin user can be found here, Authenticate with SCRAM
# run mongod authenticated
mongod --auth --port 27017 --dbpath /opt/homebrew/var/mongodb
# run mongosh with admin (please use unique user and password)
mongosh --port 27017 --authenticationDatabase "admin" -u "myUserAdmin" -p
# unit tests
$ npm run test
# e2e tests
$ npm run test:e2e
# test coverage
$ npm run test:cov