Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,9 @@ Delete an event:

## API Documentation
API Swagger documentation can be accessed from the docker host machine: `http://localhost:3004/documentation`
Schema documents are available in OpenAPI v2 and v3 flavors.
* OpenAPI v2 Schema (Swagger) `http://localhost:3004/swagger.json`
* OpenAPI v3 Schema `http://localhost:3004/openapi.json`

## Heroku Deploy

Expand Down
8 changes: 8 additions & 0 deletions config.js
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,14 @@ module.exports = {
admin_email: process.env.ADMIN_EMAIL || 'info@heatsynclabs.org',
domain: process.env.DOMAIN_LOCATION || 'http://localhost:3005',
domain_dev: process.env.DOMAIN_LOCATION_DEV || 'http://localhost:3005',
openapiOptions: {
info: {
title: Pack.name,
description: Pack.description + ' - ' + env,
version: Pack.version,
},
pathPrefixSize: 3,
},
server_url: process.env.SERVER_URL || `http://localhost:${port}`,
swaggerOptions: {
info: {
Expand Down
11 changes: 9 additions & 2 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ const Hapi = require('@hapi/hapi');
const Inert = require('@hapi/inert');
const Vision = require('@hapi/vision');
const JWTAuth = require('hapi-auth-jwt2');
const HapiOpenapi3 = require('hapi-openapi3');
const HapiSwagger = require('hapi-swagger');
const CookieAuth = require('@hapi/cookie');
const debug = require('debug')('errors');
Expand All @@ -41,10 +42,16 @@ async function start() {
JWTAuth,
Inert,
Vision,
{
plugin: HapiOpenapi3,
options: {
...config.openapiOptions,
includeFn: () => true,
}
},
{
plugin: HapiSwagger,
// eslint-disable-next-line
options: config.swaggerOptions
options: config.swaggerOptions,
},
]);
} catch (error) {
Expand Down
94 changes: 63 additions & 31 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,8 @@
"custom-error": "^0.2.1",
"debug": "^4.3.4",
"hapi-auth-jwt2": "^10.2.0",
"hapi-swagger": "^15.0.0",
"hapi-openapi3": "^1.0.9",
"hapi-swagger": "^16.0.1",
"joi": "^17.7.0",
"jsonwebtoken": "^9.0.0",
"knex": "^2.3.0",
Expand Down
3 changes: 1 addition & 2 deletions routes/users.js
Original file line number Diff line number Diff line change
Expand Up @@ -214,8 +214,7 @@ module.exports = [
token: Joi.string().uuid().required(),
}),
payload: Joi.object({
password: Joi.string().regex(/^[a-zA-Z0-9]{6,1000}$/).required(),
verify_password: Joi.any().valid(Joi.ref('password')).required()
password: Joi.string().regex(/^[a-zA-Z0-9]{6,1000}$/).required()
})
},
},
Expand Down