Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/emmanuelaytuz/test-hapijs
https://github.com/emmanuelaytuz/test-hapijs
api-rest autentication crud hapijs mongodb
Last synced: 25 days ago
JSON representation
- Host: GitHub
- URL: https://github.com/emmanuelaytuz/test-hapijs
- Owner: EmmanuelAyTuz
- Created: 2020-06-23T16:47:00.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2020-06-25T20:08:20.000Z (over 4 years ago)
- Last Synced: 2024-11-04T20:47:19.463Z (2 months ago)
- Topics: api-rest, autentication, crud, hapijs, mongodb
- Language: JavaScript
- Homepage:
- Size: 16.6 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# test-hapijs
---
### Init
Install the **dependencies** and **devDependencies** and start the API.
```sh
$ git clone https://github.com/EmmanuelAyTuz/test-hapijs.git
$ cd test-hapijs
$ npm install
$ npm run dev
```### Environments
Rename file _.env.example_ to _.env_
## Test endpoints
First send a [GET / init][get_init] (Generate a default User)
Login with "POST / login" body {username: "Admin", password: "Admin"}- Test methods
- [GET][get_test] /
- POST /
- PUT /
- DELETE /> In the other endpoints with POST, PUT & DELETE header use software such as "Insomia" or "Postman"
### Endpoints
If you are logged in as Admin you will access all the endpoints instead if you log in as User it will only access the endpoints of it.
| Method | Endpoint | Body | Params | User | Admin | Auth |
| ------ | ------ | ------ | ------ | ------ | ------ | ------ |
| POST | / | | | _ | _ | _ |
| GET | / | | | _ | _ | _ |
| PUT | / | | | _ | _ | _ |
| DELETE | / | | | _ | _ | _ |
| GET | /init | | | | | |
| POST | /login | { username, password } | | _ | _ | |
| POST | /{version}/user/create | { username, password } | | _ | _ | |
| GET | /{version}/user/all | | | _ | _ | _ |
| GET | /{version}/user/ | | { id } | _ | _ | _ |
| PUT | /{version}/user/ | { username, password } | { id } | _ | _ | _ |
| DELETE | /{version}/user/ | | { id } | _ | _ | _ |
| POST | /{version}/admin/user/create | { username, password, isAdmin } | | | _ | _ |
| GET | /{version}/admin/user/all | | | | _ | _ |
| GET | /{version}/admin/user/ | | { id } | | _ | _ |
| PUT | /{version}/admin/user/ | { username, password, isAdmin } | { id } | | _ | _ |
| DELETE | /{version}/admin/user/ | | { id } | | _ | _ |[get_test]: http://localhost:8000/
[get_init]: http://localhost:8000/init