1
0
Fork 0
mirror of https://git.rwth-aachen.de/acs/public/villas/web/ synced 2025-03-16 00:00:03 +01:00
VILLASweb/app/mirage/config.js
Markus Grigull 05b404404d Add context broker mockup with mirage
Mirage mockup is used in development environment. Adapter's host port
need to be changed for production environment.
2015-10-07 11:31:02 +02:00

38 lines
721 B
JavaScript

export default function() {
this.namespace = '/api/ngsi10';
this.post('/queryContext', function(db, request) {
return {
contextResponses: db.entities.map(attrs => ({
contextElement: {
type: attrs.type,
isPattern: false,
id: attrs.name,
attributes: attrs.properties.map(props => ({
name: props.name,
type: props.type,
value: props.value,
metadatas: [
{
name: 'timestamp',
type: 'date',
value: props.timestamp
}
]
}))
},
statusCode: {
code: 200,
reasonPhrase: 'OK'
}
}))
};
});
}
/*
You can optionally export a config that is only loaded during tests
export function testConfig() {
}
*/