This is a the backend repository for the React application HomerWorkforKids
.
When cloning the project, change the sample.env
file name for .env
. The project will run on PORT 8000.
Then, run:
npm install
- To start the project run:
npm run start
- To start the project in development mode, run:
npm run dev
- To seed the database, run:
npm run seed
Users in the database have the following properties:
const childSchema = new Schema({
name:{
type:String,
required:true
},
yearOfBirth:{
type:Number,
},
imageUrl:{
type:String,
},
tasks: {
type: [mongoose.Schema.ObjectId],
ref: 'Task',
},
user: {
type: mongoose.Schema.ObjectId,
ref: 'User',
},
points:{
type:Number
},
pointsCup:{
type:Number
},
cups:{
type:Number
},
goalTasks:{
type:Number
},
taskDone:{
type:Number
}
})
module.exports = model("Child", childSchema)
Action | Method | Endpoint | Req.body | Private/Public |
---|---|---|---|---|
SIGN UP user | POST | /api/v1/auth/signup | { username, email, password } | Public |
LOG IN user | POST | /api/v1/auth/login | { email, password } | Public |
GET logged in user | GET | /api/v1/auth/me | Private | |
Create new child | POST | /api/v1/child | Private | |
Find all child | GET | /api/v1/child/mine | Private | |
Find one child | GET | /api/v1/child/:id | Private | |
Delete child | POST | /api/v1/child | Private | |
Edit child | POST | /api/v1/child/:id | Private | |
Add task child | POST | /api/v1/child:id | Private |