This project is a simple RESTFul API in which uses mongodb
and mongoose
.
Before proceeding with this guide, you will need a mongo database. Therefore,
Create a MongoDB cluster and save its URI
because we will use it later.
yarn install
First, create a .env
file in the root of the project.
Then, add these variables:
HOSTNAME
PORT
MONGO_URI
(Observation): the code below is in the package.json
file and it allows typescript to use the module resolution strategy defined in the tsconfig.json
. The parameter require
means to execute the module tsconfig-paths/register
before anything else.
ts-node --require tsconfig-paths/register
yarn run dev
After installing the Rest Client
extension on vscode
, open the requests.rest
file to send HTTP requests.