Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/luqmanoop/node-postgres-api
A simple blog API built with Node.js + Express + PostgreSQL
https://github.com/luqmanoop/node-postgres-api
es6 express nodejs postgres postgresql rest-api
Last synced: 12 days ago
JSON representation
A simple blog API built with Node.js + Express + PostgreSQL
- Host: GitHub
- URL: https://github.com/luqmanoop/node-postgres-api
- Owner: luqmanoop
- License: mit
- Created: 2018-09-23T12:33:24.000Z (about 6 years ago)
- Default Branch: develop
- Last Pushed: 2018-09-27T21:06:23.000Z (about 6 years ago)
- Last Synced: 2024-04-27T16:00:49.063Z (7 months ago)
- Topics: es6, express, nodejs, postgres, postgresql, rest-api
- Language: JavaScript
- Homepage:
- Size: 117 KB
- Stars: 3
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Introduction
A simple blog API built using NodeJS + Express + Postgres.
## Installation
```bash
$ git clone [email protected]:codeshifu/node-postgres-api.git$ cd node-postgres-api
$ npm install
```### Rename _.env.sample_ to .env and set database connection
```
DB_URL=postgres://user:password@host:port/database
```## Run
```bash
$ npm run dev
```Visit http://localhost:8000/api/v1
### Available endpoints
`/api/v1/authors`
| method | route | description |
| ------ | ------------------ | -------------------- |
| GET | /authors | Get authors |
| POST | /authors | Create author |
| GET | /authors/:id | Get author by ID |
| GET | /authors/:id/posts | Get posts by author |
| PUT | /authors/:id | Update author |
| DELETE | /authors/:id | Delete/remove author |`/api/v1/posts`
| method | route | description |
| ------ | ---------- | -------------------- |
| GET | /posts | Get posts |
| POST | /posts | Create post |
| GET | /posts/:id | Get posts by ID |
| PUT | /posts/:id | Update author |
| DELETE | /posts/:id | Delete/remove author |