Blame view

node_modules/loopback-component-explorer/example/hidden.js 763 Bytes
f7563de62   Palak Handa   first commit
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
  // Copyright IBM Corp. 2014,2016. All Rights Reserved.
  // Node module: loopback-component-explorer
  // This file is licensed under the MIT License.
  // License text available at https://opensource.org/licenses/MIT
  
  var g = require('strong-globalize')();
  
  var loopback = require('loopback');
  var app = loopback();
  var explorer = require('../');
  var port = 3000;
  
  var User = loopback.Model.extend('user', {
    username: 'string',
    email: 'string',
    sensitiveInternalProperty: 'string',
  }, { hidden: ['sensitiveInternalProperty'] });
  
  User.attachTo(loopback.memory());
  app.model(User);
  
  var apiPath = '/api';
  explorer(app, { basePath: apiPath });
  app.use(apiPath, loopback.rest());
  g.log('{{Explorer}} mounted at {{localhost:%s/explorer}}', port);
  
  app.listen(port);