Make sure you've got yarn and install the project's dependencies
yarn
yarn start:dev
yarn start
Now just go to http://localhost:8080/ and you'll be good to go.
- id
- first_name
- last_name
- phoneNo
- password
- events
- points
- trophies
- createdAt
- id
- name
- shortDescription
- description
- location
- startDate
- endDate
- createdBy
- createdAt
- users
- id
- title
- content
- likes
- userId
- createdAt
- id
- content
- likes
- postId
- userId
- createdAt
- To add a user
var axios = require('axios');
var data = JSON.stringify({
"id": 110,
"firstName": "Rajesh",
"lastName": "Kooo",
"email": "newRajesh@gmail.com",
"phoneNo": 1234567890,
"password": "rajeshAwesome",
"events": [1, 3],
"points": 540,
"trophies": ["Mr. Green"],
"createdAt": 399299988
});
var config = {
method: 'post',
url: 'http://localhost:3000/users',
headers: {
'Content-Type': 'application/json'
},
data: data
};
axios(config)
.then(function(response) {
console.log(JSON.stringify(response.data));
})
.catch(function(error) {
console.log(error);
});
- To add a post
var axios = require('axios');
var data = JSON.stringify({
"id": 9999,
"title": "Wow, this posts!",
"content": "Omg, this should be a winner project! Give them prize already omg!",
"likes": 69,
"userId": 7,
"createdAt": 488702310
});
var config = {
method: 'post',
url: 'http://localhost:3000/posts',
headers: {
'Content-Type': 'application/json'
},
data: data
};
axios(config)
.then(function(response) {
console.log(JSON.stringify(response.data));
})
.catch(function(error) {
console.log(error);
});
- To add a comment
var axios = require('axios');
var data = JSON.stringify({
"id": 777,
"content": "I know! I 100% agree with you",
"likes": 4,
"postId": 1,
"userId": 3,
"createdAt": 825081721
});
var config = {
method: 'post',
url: 'http://localhost:3000/comments',
headers: {
'Content-Type': 'application/json'
},
data: data
};
axios(config)
.then(function(response) {
console.log(JSON.stringify(response.data));
})
.catch(function(error) {
console.log(error);
});
pm2 start yarn --interpreter bash --name "earthy-server" -i -1 -- start