Skip to content
This repository was archived by the owner on May 28, 2023. It is now read-only.

Commit 13a4628

Browse files
committed
Merge branch 'master' of https://github.com/DivanteLtd/vue-storefront-api into develop
2 parents 1ce3dc6 + 570873a commit 13a4628

File tree

2 files changed

+39
-7
lines changed

2 files changed

+39
-7
lines changed

README.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -39,20 +39,20 @@ As a result, all necessary services will be launched:
3939
- [Redis](https://redis.io/)
4040
- Kibana (optional)
4141

42-
Then, to update the structures in the database to the latest version (data migrations), do the following:
43-
44-
- (A) `docker exec -it vuestorefrontapi_app_1 yarn migrate`
45-
- (B) `yarn migrate`
46-
47-
By default, the application server is started in development mode. It means that code auto reload is enabled along with ESLint, babel support.
48-
4942
**Import product catalog**
5043

5144
Product catalog is imported using [elasticdump](https://www.npmjs.com/package/elasticdump), which is installed automatically via project dependency. The default ElasticSearch index name is: `vue_storefront_catalog`
5245

5346
- (A) `yarn restore`
5447
- (B) `docker exec -it vuestorefrontapi_app_1 yarn restore`
5548

49+
Then, to update the structures in the database to the latest version (data migrations), do the following:
50+
51+
- (A) `docker exec -it vuestorefrontapi_app_1 yarn migrate`
52+
- (B) `yarn migrate`
53+
54+
By default, the application server is started in development mode. It means that code auto reload is enabled along with ESLint, babel support.
55+
5656
It restores JSON documents stored in `./var/catalog.json`. The opposite command - used to generate `catalog.json` file from running ElasticSearch cluster:
5757

5858
- (A) `yarn dump`

src/api/extensions/cms-data/index.js

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,5 +38,37 @@ module.exports = ({ config, db }) => {
3838
})
3939
})
4040

41+
cmsApi.get('/cmsPageIdentifier/:identifier/storeId/:storeId', (req, res) => {
42+
const client = Magento2Client(config.magento2.api);
43+
client.addMethods('cmsPageIdentifier', function (restClient) {
44+
let module = {};
45+
module.getPageIdentifier = function () {
46+
return restClient.get(`/snowdog/cmsPageIdentifier/${req.params.identifier}/storeId/${req.params.storeId}`);
47+
}
48+
return module;
49+
})
50+
client.cmsPageIdentifier.getPageIdentifier().then((result) => {
51+
apiStatus(res, result, 200); // just dump it to the browser, result = JSON object
52+
}).catch(err => {
53+
apiStatus(res, err, 500);
54+
})
55+
})
56+
57+
cmsApi.get('/cmsBlockIdentifier/:identifier/storeId/:storeId', (req, res) => {
58+
const client = Magento2Client(config.magento2.api);
59+
client.addMethods('cmsBlockIdentifier', function (restClient) {
60+
let module = {};
61+
module.getBlockIdentifier = function () {
62+
return restClient.get(`/snowdog/cmsBlockIdentifier/${req.params.identifier}/storeId/${req.params.storeId}`);
63+
}
64+
return module;
65+
})
66+
client.cmsBlockIdentifier.getBlockIdentifier().then((result) => {
67+
apiStatus(res, result, 200); // just dump it to the browser, result = JSON object
68+
}).catch(err => {
69+
apiStatus(res, err, 500);
70+
})
71+
})
72+
4173
return cmsApi
4274
}

0 commit comments

Comments
 (0)