Skip to content

Commit

Permalink
feat: upgrade to @Hapi (#201)
Browse files Browse the repository at this point in the history
* feat: upgrade to @Hapi

* feat: use joi-objectid fork to use latest joi

* fix: payload test

* Revert "fix: payload test"

This reverts commit 44d2d9f.

* feat: validate shim & eslint --fix

* feat: use loggin fork

* feat: upgrade loggin

* fix: upgrade loggin to newest version

* bugfix: hapi 18 changes to server.inject

* chore: update husky config

* refactor: revert to joi 14 to avoid major breaking changes
  • Loading branch information
mkg20001 authored and JKHeadley committed Sep 21, 2019
1 parent ef5d919 commit a11cbfc
Show file tree
Hide file tree
Showing 68 changed files with 6,677 additions and 7,237 deletions.
2 changes: 1 addition & 1 deletion config.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/**
* config.js - Configuration settings for the generated API
*/
let config = {}
const config = {}
config.mongo = {}

/**
Expand Down
4 changes: 2 additions & 2 deletions docs/creating-endpoints.md
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ If endpoints beyond the generated CRUD endpoints are needed for a model, they ca

```javascript
// models/user.model.js
let Joi = require('joi')
let Joi = require('@hapi/joi')
let bcrypt = require('bcrypt')
let RestHapi = require('rest-hapi')

Expand Down Expand Up @@ -136,7 +136,7 @@ module.exports = function (mongoose) {
// Password Update Endpoint
function (server, model, options, logger) {
const Log = logger.bind("Password Update")
let Boom = require('boom')
let Boom = require('@hapi/boom')

let collectionName = model.collectionDisplayName || model.modelName

Expand Down
2 changes: 1 addition & 1 deletion docs/introduction.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ As rest-hapi is a hapi plugin, you'll need to set up a hapi server to generate A

```javascript
// api.js
let Hapi = require('hapi')
let Hapi = require('@hapi/hapi')
let mongoose = require('mongoose')
let RestHapi = require('rest-hapi')

Expand Down
2 changes: 1 addition & 1 deletion docs/policies.md
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ To provide an example of the power of policies within rest-hapi, consider the fo
A developer wants to implement document authorization, but wants to maintain control over the implementation and have the option of providing functionality outside of what is available with rest-hapi's built in [document authorization](authorization.md#document-authorization). They want to only allow the user that creates a document to be able to modify the document. They decide to implement this via the policy below (`docAuth.js`).

```javascript
const Boom = require('boom')
const Boom = require('@hapi/boom')

let docAuth = async function(request, h) {
let Log = request.logger
Expand Down
6 changes: 3 additions & 3 deletions models/audit-log.model.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ const Config = require('../config')
const _ = require('lodash')

module.exports = function(mongoose) {
let modelName = 'auditLog'
let Types = mongoose.Schema.Types
let Schema = new mongoose.Schema(
const modelName = 'auditLog'
const Types = mongoose.Schema.Types
const Schema = new mongoose.Schema(
{
date: {
type: Types.Date,
Expand Down
Loading

0 comments on commit a11cbfc

Please sign in to comment.