express-joi-simple
Advanced tools
Comparing version 1.0.6 to 1.0.7
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
var express = require("express"); | ||
var index_1 = require("../index"); | ||
var router_1 = require("./router"); | ||
var BodyParser = require("body-parser"); | ||
var joi = require("joi"); | ||
var index_1 = require("../index"); | ||
var settings_1 = require("./settings"); | ||
var app = express(); | ||
app.use(BodyParser.json()); | ||
app.use(index_1.RequestHandler); | ||
var schema = { | ||
body: { | ||
test1: joi.string().required() | ||
} | ||
}, | ||
model: 'Register' | ||
}; | ||
app.post('register', index_1.factory.validateJoiSchema(schema), function (req, res) { | ||
app.post('/register', index_1.Validate(schema), function (req, res) { | ||
res.json({ | ||
@@ -19,6 +24,6 @@ message: 'register' | ||
app.use('/login', router_1.router); | ||
app.use(index_1.RequestHandler); | ||
app.listen(3000, function () { | ||
index_1.factory.generateDoc(app); | ||
console.log('App started on port 3000'); | ||
index_1.Doc(app, settings_1.settings); | ||
}); | ||
//# sourceMappingURL=index.js.map |
@@ -10,7 +10,8 @@ "use strict"; | ||
test1: joi.string().required() | ||
} | ||
}, | ||
model: 'Login' | ||
}; | ||
exports.router.post('/test', index_1.factory.validateJoiSchema(schema), function (req, res) { | ||
exports.router.post('/test', index_1.Validate(schema), function (req, res) { | ||
res.json({ message: 'test' }); | ||
}); | ||
//# sourceMappingURL=router.js.map |
@@ -1,2 +0,3 @@ | ||
import { ExpressJoiSimple } from './express-joi-simple'; | ||
export declare const factory: ExpressJoiSimple; | ||
export * from './Doc'; | ||
export * from './Validate'; | ||
export * from './RequestHandler'; |
"use strict"; | ||
function __export(m) { | ||
for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p]; | ||
} | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
var express_joi_simple_1 = require("./express-joi-simple"); | ||
exports.factory = new express_joi_simple_1.ExpressJoiSimple(); | ||
__export(require("./Doc")); | ||
__export(require("./Validate")); | ||
__export(require("./RequestHandler")); | ||
//# sourceMappingURL=index.js.map |
{ | ||
"name": "express-joi-simple", | ||
"version": "1.0.6", | ||
"version": "1.0.7", | ||
"description": "", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
26628
41
409
3