https://github.com/lore/lore-tutorial-api
API Server for the Lore Tutorial
https://github.com/lore/lore-tutorial-api
Last synced: about 1 year ago
JSON representation
API Server for the Lore Tutorial
- Host: GitHub
- URL: https://github.com/lore/lore-tutorial-api
- Owner: lore
- Created: 2016-10-04T09:01:20.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2018-07-29T21:12:35.000Z (over 7 years ago)
- Last Synced: 2025-01-21T08:07:33.950Z (about 1 year ago)
- Language: JavaScript
- Homepage: http://www.lorejs.org/tutorial/
- Size: 70.3 KB
- Stars: 0
- Watchers: 3
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Lore Tutorial API Server
This is the API server for the Lore tutorial. It is a [Sails](http://sailsjs.org) application.
## Installation
First clone this repository:
```
git clone git@github.com: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:
```js
{
tweets: "http://localhost:1337/tweets",
users: "http://localhost:1337/users",
user: "http://localhost:1337/user"
}
```
## Endpoints
Documentation for each endpoint.
### /tweets
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"
}
```
### /users
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"
}
```
### /user
This endpoint returns the current user (assuming you've passed along an `Authorization` header with a valid token.