Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/darkwebdev/blog-api
Simple blog API
https://github.com/darkwebdev/blog-api
Last synced: about 1 month ago
JSON representation
Simple blog API
- Host: GitHub
- URL: https://github.com/darkwebdev/blog-api
- Owner: darkwebdev
- Created: 2020-02-29T14:10:26.000Z (almost 5 years ago)
- Default Branch: master
- Last Pushed: 2023-01-05T08:39:28.000Z (about 2 years ago)
- Last Synced: 2024-04-16T22:28:35.283Z (9 months ago)
- Language: TypeScript
- Homepage:
- Size: 1.27 MB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 14
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# blog-api
Simple blog API using Node.js and SQLite## Install
```
yarn
```## Run
```
yarn start
```## Lint
```
yarn lint
```## Test
```
yarn test
```## Models
`Post` - Represents a blog post — properties:`id` - UUID4 generated id
`title` - The title of the post
`body` - The body of the post
`author_id` - The id of the user who created the post
`created_at` - The date in which the post was created (saved to db)`User` - Represents the writer of a post — properties:
`id` - UUID4 generated id
`username` - The username of the user
`password` - A hashed representation of the user’s password
## Endpoints
`POST: /users` - Creates a user — params:`username` - The username to give the user
`password` - The password the user wishes to have
`@returns` - A secure authentication token`POST: /users/auth` - Authenticates a user — params:
`username` - The username of the user
`password` - The password of the user
`@returns` - A secure authentication token`GET: /posts` - Returns all post (recent first) — params:
`limit` - The max number of posts to return (default: 10)
`@returns` - All the properties of the model`GET: /posts/{id}` - Returns the post for the given id:
`@returns` - All the properties of the model
`POST: /posts` - Creates a new post — params:
`HEADER: X-TOKEN` - The authentication token of the user
`@returns` - All the properties of the newly created model