Convert the REST API from last weeks assignment to use MongoDB and Mongoose
- Clone this repo
- create .env based on .env.example
npm i
to install dependenciesnpm run dev
to start development servernpm run test
to run tests
- Your task is to complete all TODOs in the code until all tests are passed
Cat:
{
"_id",
"cat_name": "Siiri",
"weight": 4,
"filename": "9434b5b5d9222ed366d22ebcc8e5c828",
"birthdate": "2010-03-04",
"location": {
"type": "Point",
"coordinates" : [
61.5,
24.7
]
}
"owner": {
"_id": 37,
"user_name": "Test User",
"email": "a@b.fi"
}
}
User:
{
"_id": 37,
"user_name": "Test User", // this is not username, just firsname lastname
"email": "john@metropolia.fi", // shoud be unique
"role": "user", // or "admin" // don't send this
"password": "1234" // don't send this
}
- Create the Schemas based on the intefaces/types above
- /auth
- /users
- /cats
- login users email as username
- create admin manually to user collection: admin@metropolia.fi, password: 1234
- Always empty your cats after tests.