Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/mabc224/pgreact-simple
https://github.com/mabc224/pgreact-simple
Last synced: about 1 month ago
JSON representation
- Host: GitHub
- URL: https://github.com/mabc224/pgreact-simple
- Owner: mabc224
- License: mit
- Created: 2015-10-14T15:10:55.000Z (about 9 years ago)
- Default Branch: master
- Last Pushed: 2015-10-14T15:16:49.000Z (about 9 years ago)
- Last Synced: 2023-03-01T17:47:06.792Z (almost 2 years ago)
- Language: JavaScript
- Size: 297 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# pgreact-simple
A simple **React.js**-**Node.js**-**PostgreSQL** web application implementing basic CRUD operations through RESTful APIs.
As always, clean and good-looking code following RESTful best practices. These are the rules.
## Install and Run
$ npm install -g grunt
$ npm install
$ grunt default
Then, in another tab:$ npm start
You can now point your browser to `http://localhost:3000/`. Assure PostgreSQL is up and running.## Tests
Start the backend in another console, then run:
$ npm test
Assure PostgreSQL is up and running.## Implemented APIs
- `GET /api/users`:
Returns an array of users:
@param: void
@return: {
error: boolean,
results: [
user: {
id: int,
name: string,
age: int,
email: string
}
]
}If an id is provided as query parameter, eg. `http://:/users?id=12345`, then the result is the following:
@param: id: int
@return: {
error: boolean,
user: {
id: int,
name: string,
age: int,
email: string
}
}
- `POST /api/users`:Insert a new user entry into the database:
@param: user: {
[id: int,]
name: string,
age: int,
email: string
}
@return: { error: boolean }- `PUT /api/users`:
Update an user entry:
@param: { id: int }
@return: { error: boolean }- `DELETE /api/users`:
Delete an user entry from the database:
@param: user: {
id: int,
name: string,
age: int,
[email: string]
}
@return: { error: boolean }