This is the API server for the Lore tutorial. It is a Sails application.
First clone this repository:
git clone [email protected]:lore/lore-tutorial-api.git
Then navigate into the repository:
cd lore-tutorial-api
Next install the dependencies:
npm install
Then start the API server:
npm start
To confirm the API server is installed and running, navigate to http://localhost:1337
and you should see a list of the endpoints for this API:
{
tweets: "http://localhost:1337/tweets",
users: "http://localhost:1337/users",
user: "http://localhost:1337/user"
}
Documentation for each endpoint.
This endpoint returns a list of tweets. Anyone can GET the list of tweets, but creating, updating or deleting tweets requires authentication. Example tweet:
{
id: 1,
user: 4,
text: "Yummy frog! For Ayla eat?",
createdAt: "2016-10-17T22:35:40.035Z",
updatedAt: "2016-10-29T22:35:40.064Z"
}
This endpoint returns a list of users. Example user:
{
id: 4,
nickname: "ayla",
avatar: "https://cloud.githubusercontent.com/assets/2637399/19027069/a356e82a-88e1-11e6-87d8-e3e74f55c069.png",
createdAt: "2016-10-29T22:35:40.024Z",
updatedAt: "2016-10-29T22:35:40.024Z"
}
This endpoint returns the current user (assuming you've passed along an Authorization
header with a valid token.