summaryrefslogtreecommitdiffstats
path: root/catalog-ui/SETTING-MOCK-SERVER.md
diff options
context:
space:
mode:
authorMichael Lando <ml636r@att.com>2017-02-19 10:28:42 +0200
committerMichael Lando <ml636r@att.com>2017-02-19 10:51:01 +0200
commit451a3400b76511393c62a444f588a4ed15f4a549 (patch)
treee4f5873a863d1d3e55618eab48b83262f874719d /catalog-ui/SETTING-MOCK-SERVER.md
parent5abfe4e1fb5fae4bbd5fbc340519f52075aff3ff (diff)
Initial OpenECOMP SDC commit
Change-Id: I0924d5a6ae9cdc161ae17c68d3689a30d10f407b Signed-off-by: Michael Lando <ml636r@att.com>
Diffstat (limited to 'catalog-ui/SETTING-MOCK-SERVER.md')
-rw-r--r--catalog-ui/SETTING-MOCK-SERVER.md53
1 files changed, 53 insertions, 0 deletions
diff --git a/catalog-ui/SETTING-MOCK-SERVER.md b/catalog-ui/SETTING-MOCK-SERVER.md
new file mode 100644
index 0000000000..5db508f225
--- /dev/null
+++ b/catalog-ui/SETTING-MOCK-SERVER.md
@@ -0,0 +1,53 @@
+# Prerequisites
+
+1. install [node.js](http://nodejs.org/download/)
+2. install [git](http://git-scm.com/). __Make sure to select the option to add git into $PATH__
+3. install dependencies [express,cors] npm install express, npm install cors
+
+
+
+# Create the server file
+Example:
+
+#############################################
+ar express = require('express');
+var mockUris = require('../configurations/mock.json');
+var cors = require('cors');
+
+
+var app = express();
+
+// declare server cross browser
+app.use(cors({
+ origin: '*',
+ methods: 'GET, POST, PUT, DELETE',
+ allowedHeaders: 'Content-Type,Authorization,If-Modified-Since'
+}));
+
+/******************************************* MOCKS ENPOINTS *************************************************/
+/* poiFind */
+app.get('/v1' + mockUris.generalConf.getPoiFind.split('v1')[1], function (req, res) {
+ var pois = require('./data/poi/poi-search.json'); // the json response for the api call
+ res.send(pois);
+});
+
+/**************************************************** *******************************************************/
+// declare server listener port
+var server = app.listen(9999, function () {
+ console.log('mock server listening on port %d', server.address().port);
+});
+
+################################
+
+#create mockDate
+
+1. create json file with the response.
+2. add the api end point in the server file and declare the json file for the response/
+
+
+
+# Running the server
+
+1. go to server file folder
+2. run command : node <FileName>
+