-Run following commands
-1. open terminal
-2. cd your_own_directory
-3. RUN - git@github.com:parmeet10/frejun_api.git
-4. cd frejun_api
-5. npm install
-6. npm start
http://localhost:3000/authenticationhttp://localhost:3000/blogshttp://localhost:3000/blogs/update?blogId=1
The reachability of the host can be checked through the Ping API. The API responds with a pong to communicate availability to the requesting client.
GET
/ping
None
None
None
String
pong
provides token to access other API'S, gives better control and accessibility over the api's
GET
/authentication
None
None
None
JSON
{
"token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJwYXlsb2FkIjoiVGh1IE9jdCAwNiAyMDIyIDEzOjUxOjA1IEdNVCswNTMwIChJbmRpYSBTdGFuZGFyZCBUaW1lKSIsImlhdCI6MTY2NTA0NDQ2NX0.RP3iAfICoafRhCpk0b4nrD3fk35FicmPguC8NoXyhu0"
}
API to post blogs
POST
/blogs
x-auth: eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJwYXlsb2FkIjoiVGh1IE9jdCAwNiAyMDIyIDEzOjUxOjA1IEdNVCswNTMwIChJbmRpYSBTdGFuZGFyZCBUaW1lKSIsImlhdCI6MTY2NTA0NDQ2NX0.RP3iAfICoafRhCpk0b4nrD3fk35FicmPguC8NoXyhu0
None
{
"body":"somebody told me that alternate string when pulled togethor gives us ample time to eliminate some awesome techniques which were used earlier",
"title":"someTitle",
"category":"someCategory"
}
JSON
{
"code": "success",
"error": false,
"message": "Successful",
"data": {
"blogId": 1
}
}
gives the complete list of blogs in the database
GET
/blogs
x-auth: eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJwYXlsb2FkIjoiVGh1IE9jdCAwNiAyMDIyIDEzOjUxOjA1IEdNVCswNTMwIChJbmRpYSBTdGFuZGFyZCBUaW1lKSIsImlhdCI6MTY2NTA0NDQ2NX0.RP3iAfICoafRhCpk0b4nrD3fk35FicmPguC8NoXyhu0
None
None
JSON
{
"code": "success",
"error": false,
"message": "Successful",
"data": {
"blogs": [
{
"id": 1,
"title": "someTitle",
"body": "somebody told me that altern*** string when pulled togethor gives us am*** time to eliminate some awes*** techniques which were used earlier",
"category": "someCategory",
"active": 1,
"created_at": "2022-10-06T08:23:20.000Z"
},
{
"id": 2,
"title": "someTitle",
"body": "somebody told me that alternate string when pulled togethor gives us ample time to eliminate some awesome techniques which were used earlier",
"category": "someCategory",
"active": 1,
"created_at": "2022-10-06T08:40:57.000Z"
},
{
"id": 3,
"title": "someTitle",
"body": "somebody told me that alternate string when pulled togethor gives us ample time to eliminate some awesome techniques which were used earlier",
"category": "someCategory",
"active": 1,
"created_at": "2022-10-06T08:40:58.000Z"
},
{
"id": 4,
"title": "someTitle",
"body": "somebody told me that alternate string when pulled togethor gives us ample time to eliminate some awesome techniques which were used earlier",
"category": "someCategory",
"active": 1,
"created_at": "2022-10-06T08:40:58.000Z"
}
]
}
}
update blog body in the DB in accordance with replacing last 3 words of words starting with A or a and returning those words in the response object to client
GET
/blogs?blogId=1
x-auth: eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJwYXlsb2FkIjoiVGh1IE9jdCAwNiAyMDIyIDEzOjUxOjA1IEdNVCswNTMwIChJbmRpYSBTdGFuZGFyZCBUaW1lKSIsImlhdCI6MTY2NTA0NDQ2NX0.RP3iAfICoafRhCpk0b4nrD3fk35FicmPguC8NoXyhu0
None
None
JSON
{
"code": "success",
"error": false,
"message": "Successful",
"data": {
"wordsWithA": [
"alternate",
"ample",
"awesome"
],
"blogs": [
{
"id": 1,
"title": "someTitle",
"body": "somebody told me that altern*** string when pulled togethor gives us am*** time to eliminate some awes*** techniques which were used earlier",
"category": "someCategory",
"active": 1,
"created_at": "2022-10-06T08:23:20.000Z"
}
]
}
}