Fix UI and docker
[sdc.git] / catalog-ui / SETTING-MOCK-SERVER.md
1 # Prerequisites
2
3 1. install [node.js](http://nodejs.org/download/)
4 2. install [git](http://git-scm.com/). __Make sure to select the option to add git into $PATH__
5 3. install dependencies [express,cors] npm install express, npm install cors
6
7
8
9 # Create the server file 
10 Example:
11
12 #############################################
13 ar express = require('express');
14 var mockUris = require('../configurations/mock.json');
15 var cors = require('cors');
16
17
18 var app = express();
19
20 // declare server cross browser 
21 app.use(cors({
22     origin: '*',
23     methods: 'GET, POST, PUT, DELETE',
24     allowedHeaders: 'Content-Type,Authorization,If-Modified-Since'
25 }));
26
27 /******************************************* MOCKS ENPOINTS *************************************************/
28 /* poiFind */
29 app.get('/v1' + mockUris.generalConf.getPoiFind.split('v1')[1], function (req, res) {
30     var pois = require('./data/poi/poi-search.json'); // the json response for the api call
31     res.send(pois);
32 });
33
34 /**************************************************** *******************************************************/
35 // declare  server listener  port
36 var server = app.listen(9999, function () {
37     console.log('mock server listening on port %d', server.address().port);
38 });
39
40 ################################
41
42 #create mockDate
43
44 1. create json file with the response.
45 2. add the api end point in the server file and declare the json file for the response/  
46
47
48
49 # Running the server
50
51 1. go to server file folder
52 2. run command : node <FileName>
53