This is a server created with Node/Express to support the Mental Note app.
Clone the repository and download the dependencies.
$ git clone https://github.com/nicole919/mental-note-server.git
$ cd mental-note-server
$ npm install
$ npm start
GET api/notes
- returns notes
Status: 200 OK
{
"note_id": 2,
"title": "pokemon",
"category_id": 1,
"whereat": "netflix",
"user_id": 2,
"suggesting_user_id": null,
"category_name": "Shows",
"id": null,
"user_name": "lily",
"password": null,
"interests": null,
"suggesting_user_name": null
}
GET /api/categories/
returns categories
{
"category_id": 4,
"category_name": "Books"
}
POST /api/categories/
- create a new category
{
"category_name":"recipes"
}
201 Created
{
"category_id": 8,
"category_name": "recipes"
}
POST /api/notes
- create a new note
entry
Input | Type |
---|---|
title | string (required) |
category | integer reference(required) |
whereat | string |
{
"title": "My Little Pony",
"category_id": 1,
"whereat": "netflix"
}
201 Created
POST api/users/
- create a user
{
"user_name":"katrina",
"password":"1234abcd",
"interests":"animal crossing, cookies"
}
201 Created
{
"user": {
"id": 9,
"user_name": "katrina",
"interests": "animal crossing, cookies"
},
"authToken": "[]"
}
GET api/notes/note_id
- returns a single note by ID
GET api/note/3
{
"note_id": 3,
"title": "watchmen",
"category_id": 1,
"whereat": "hbo",
"comments": "blue man",
"user_id": 1,
"suggesting_user_id": null
}
DELETE api/notes/note_id
- delete meal by ID
204 No Content