Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: upgrade to @hapi #201

Merged
merged 11 commits into from
Sep 21, 2019
Merged
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