subscriber REST API is done
This commit is contained in:
parent
5b49df0d54
commit
68486ac643
|
@ -18,6 +18,7 @@
|
|||
"express-session": "^1.15.2",
|
||||
"immutable": "^3.8.1",
|
||||
"lusca": "^1.4.1",
|
||||
"method-override": "^2.3.9",
|
||||
"mongoose": "^4.10.5",
|
||||
"morgan": "^1.8.2",
|
||||
"next": "^2.3.1",
|
||||
|
|
|
@ -9,6 +9,7 @@ const handle = app.getRequestHandler();
|
|||
|
||||
const express = require('express');
|
||||
const bodyParser = require('body-parser');
|
||||
const methodOverride = require('method-override');
|
||||
const morgan = require('morgan');
|
||||
const session = require('express-session');
|
||||
|
||||
|
@ -56,6 +57,7 @@ co(function* () {
|
|||
|
||||
server.use(bodyParser.json());
|
||||
server.use(bodyParser.urlencoded({ extended: true }));
|
||||
server.use(methodOverride());
|
||||
|
||||
server.use(session({
|
||||
secret: secret,
|
||||
|
|
|
@ -2,7 +2,7 @@ const mongoose = require('mongoose');
|
|||
const Schema = mongoose.Schema;
|
||||
|
||||
const Subscriber = new Schema({
|
||||
imsi: { type: String, unique: true, required: true },
|
||||
imsi: { $type: String, unique: true, required: true },
|
||||
|
||||
access_restriction_data: Number,
|
||||
subscriber_status: Number,
|
||||
|
@ -33,6 +33,6 @@ const Subscriber = new Schema({
|
|||
op: String,
|
||||
amf: String
|
||||
}
|
||||
});
|
||||
}, { typeKey: '$type' });
|
||||
|
||||
module.exports = mongoose.model('Subscriber', Subscriber);
|
|
@ -2,13 +2,12 @@ const express = require('express');
|
|||
const router = express.Router();
|
||||
|
||||
const restify = require('express-restify-mongoose')
|
||||
const options = {
|
||||
prefix: '',
|
||||
version: ''
|
||||
}
|
||||
|
||||
const Subscriber = require('../models/subscriber');
|
||||
|
||||
restify.serve(router, Subscriber, options);
|
||||
restify.serve(router, Subscriber, {
|
||||
prefix: '',
|
||||
version: '',
|
||||
idProperty: 'imsi'
|
||||
});
|
||||
|
||||
module.exports = router;
|
|
@ -2558,15 +2558,7 @@ lodash.isplainobject@~4.0.0:
|
|||
version "4.0.6"
|
||||
resolved "https://registry.yarnpkg.com/lodash.isplainobject/-/lodash.isplainobject-4.0.6.tgz#7c526a52d89b45c45cc690b88163be0497f550cb"
|
||||
|
||||
lodash@^4.13.1, lodash@^4.14.0, lodash@^4.3.0, lodash@^4.5.1, lodash@^4.6.1:
|
||||
version "4.17.4"
|
||||
resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.4.tgz#78203a4d1c328ae1d86dca6460e369b57f4055ae"
|
||||
|
||||
lodash@^4.2.0, lodash@^4.2.1:
|
||||
version "4.12.0"
|
||||
resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.12.0.tgz#2bd6dc46a040f59e686c972ed21d93dc59053258"
|
||||
|
||||
lodash@~4.16.0:
|
||||
lodash@^4.13.1, lodash@^4.14.0, lodash@^4.2.0, lodash@^4.2.1, lodash@^4.3.0, lodash@^4.5.1, lodash@^4.6.1, lodash@~4.16.0:
|
||||
version "4.16.6"
|
||||
resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.16.6.tgz#d22c9ac660288f3843e16ba7d2b5d06cca27d777"
|
||||
|
||||
|
@ -2619,6 +2611,15 @@ merge-descriptors@1.0.1:
|
|||
version "1.0.1"
|
||||
resolved "https://registry.yarnpkg.com/merge-descriptors/-/merge-descriptors-1.0.1.tgz#b00aaa556dd8b44568150ec9d1b953f3f90cbb61"
|
||||
|
||||
method-override@^2.3.9:
|
||||
version "2.3.9"
|
||||
resolved "https://registry.yarnpkg.com/method-override/-/method-override-2.3.9.tgz#bd151f2ce34cf01a76ca400ab95c012b102d8f71"
|
||||
dependencies:
|
||||
debug "2.6.8"
|
||||
methods "~1.1.2"
|
||||
parseurl "~1.3.1"
|
||||
vary "~1.1.1"
|
||||
|
||||
methods@~1.1.2:
|
||||
version "1.1.2"
|
||||
resolved "https://registry.yarnpkg.com/methods/-/methods-1.1.2.tgz#5529a4d67654134edcc5266656835b0f851afcee"
|
||||
|
|
Loading…
Reference in New Issue