How to install multiple Recipes in Hybris - sap-commerce-cloud

I have installed b2b_b2c_acc recipe and I need to work on oms(Order management ) few have suggested me to install b2c_acc_oms have some set of extenstions releate to order management. if I install b2c_acc_oms recipe will this recipe overrides the previous one ?

Yes, it will override it.
You can manually add b2c_acc_oms extensions to your extensions.xml file on your config folder then ant clean all.

If I install b2c_acc_oms recipe will this recipe override the previous
one?
Yes, It will override previously installed recipe.
You have to manually add b2c_acc_oms extensions to your localextensions.xml file, to identify list of extensions, you can refer build.gradle file (installer/recipes/b2c_acc_oms/build.gradle)
extName 'ldap'
extName 'virtualjdbc'
extName 'springintegrationlibs'
extName 'hmc'
extName 'voucher'
extName 'platformhmc'
extName 'promotions'
extName 'customerreview'
extName 'backoffice'
extName 'cockpit'
extName 'admincockpit'
extName 'reportcockpit'
extName 'productcockpit'
extName 'solrfacetsearch'
extName 'basecommerce'
extName 'cms2'
extName 'cms2lib'
extName 'btg'
extName 'ticketsystem'
extName 'payment'
extName 'cmscockpit'
extName 'solrfacetsearchhmc'
extName 'commerceservices'
extName 'commercewebservicescommons'
extName 'acceleratorservices'
extName 'acceleratorcms'
extName 'yacceleratorcore'
extName 'commercefacades'
extName 'acceleratorfacades'
extName 'addonsupport'
extName 'acceleratorstorefrontcommons'
extName 'yacceleratorfacades'
extName 'commercesearch'
extName 'commercesearchhmc'
extName 'acceleratorwebservicesaddon'
extName 'yaddon'
extName 'yacceleratorinitialdata'
extName 'apparelstore'
extName 'yacceleratorstorefront'
extName 'cscockpit'
extName 'yacceleratorcockpits'
extName 'instore'
extName 'electronicsstore'
extName 'warehousingbackoffice'
extName 'warehousing'
extName 'yacceleratorordermanagement'
extName 'customersupportbackoffice'
extName 'platformbackoffice'
extName 'solrserver'
extName 'ordermanagementaddon'
extName 'warehousingwebservices'
extName 'warehousingfacade'
extName 'ordermanagementwebservices'
extName 'ordermanagementfacade'
Install Addon :
ordermanagementaddon

Related

Am running into this error 'No default engine was specified and no extension was provided' in elastic beanstack health issue

Am thinking express is setting the default engine to app.set("view engine", ""); but an using angular cli and have set the engine to static files app.use(express.static(path.join(__dirname, "/paiir-dashboard/dist/paiir-dashboard")) );
onst express = require("express");
const morgan = require("morgan");
const rateLimit = require("express-rate-limit");
const helmet = require("helmet");
const ExpressMongoSanitize = require("express-mongo-sanitize");
const xss = require("xss-clean");
const hpp = require("hpp");
const cookieParser = require("cookie-parser");
const cors = require("cors");
const path = require("path");
const http = require("http");
const AppError = require("./utils/appError");
const globalErrorHandler = require("./controllers/errorController");
const app = express();
// Setting up the angular engine
//app.set("view engine", "");
//app.set("views", path.join(__dirname, "views"));
// Serving static files
app.use( express.static(path.join(__dirname, "/paiir-dashboard/dist/paiir-dashboard")) );
app.get("/*", (req, res) => response.sendfile(path.join(__dirname)));

server.use(express.static(path.join(__dirname, 'public'))); not working

CSS and Images files are not working in my application getting error "Refused to apply style from '' because its MIME type ('text/html') is not a supported stylesheet MIME type, and strict MIME checking is enabled"
I have tried "server.use(express.static(path.join(__dirname, 'public')));" but still not working ...
const express = require('express');
//const expressLayouts = require('express-ejs-layouts');
const mongoose = require('mongoose'); mongoose.set('useCreateIndex', true);
const passport = require('passport');
const flash = require('connect-flash');
const session = require('express-session');
const server = express();
const path = require("path");
const bodyParser = require("body-parser");
//Set path for static assets
//server.use(expressLayouts);
server.set('view engine', 'ejs');
//server.set('view options', { layout: false });
server.set('views', path.join(__dirname, 'views'));
server.engine('html', require('ejs').renderFile);
//Set path for static assets
server.use(express.static(path.join(__dirname, 'public')));
// Express body parser
server.use(express.urlencoded({ extended: true }));

Cannot find module 'hbs', express-handlebars

I am trying to use express-handlebars view engine for express and I keep getting the following error:
Error: Cannot find module 'hbs'
at Function.Module._resolveFilename (module.js:538:15)
at Function.Module._load (module.js:468:25)
at Module.require (module.js:587:17)
at require (internal/module.js:11:18)
at new View (C:\Users\WilPrim\Desktop\node-app\node_modules\express\lib\view.js:81:14)
at Function.render (C:\Users\WilPrim\Desktop\node-app\node_modules\express\lib\application.js:570:12)
at ServerResponse.render (C:\Users\WilPrim\Desktop\node-app\node_modules\express\lib\response.js:1008:7)
at C:\Users\WilPrim\Desktop\node-app\routes\routes.js:5:6
at Layer.handle [as handle_request] (C:\Users\WilPrim\Desktop\node-app\node_modules\express\lib\router\layer.js:95:5)
at next (C:\Users\WilPrim\Desktop\node-app\node_modules\express\lib\router\route.js:137:13)
Here is my Code:
const express = require("express");
const bodyParser = require("body-parser");
const hbs = require("express-handlebars");
const router = require("./routes/routes");
//set up express app
var app = express();
app.use(bodyParser.json());
app.set('view engine', 'hbs');
app.set('views', './views');
app.set('view options', {layout: './layouts/layout'});
app.use(router);
According to the express-handlebars documentation, you have to setup and register the view engine manually:
var express = require('express');
var exphbs = require('express-handlebars');
var app = express();
var hbs = exphbs.create({ /* config */ });
// Register `hbs.engine` with the Express app.
app.engine('handlebars', hbs.engine);
app.set('view engine', 'handlebars');
// ...still have a reference to `hbs`, on which methods like `loadPartials()`
// can be called.
Looking a little bit further down in the documentation, looks like you can still use the .hbs extension with a bit of configuration:
var express = require('express');
var exphbs = require('express-handlebars');
var app = express();
app.engine('.hbs', exphbs({extname: '.hbs'}));
app.set('view engine', '.hbs');
use command -- sudo npm link hbs
you might have named the main folder as "express"
just change the name of folder,delete "package.json" and try
"npm install" again and then
"npm install express"
"npm install hbs"
/* been using this format for some time now, never had problems */
// import system modules
const hbs = require('express-handlebars');
const express = require('express');
const app = express();
// configuring express-handlebars as hbs
app.engine('hbs', hbs.create({
extname: 'hbs',
defaultLayout: 'main'
}).engine)
// system(app) routes
app.get('/', (req, res, next)=>{
res.render('home', {title: 'HBS TITLE'});
});
// system listening port
app.listen(8080);
install this module on terminal --> npm i hbs
try npm install and npm audit fix multiple times then rum the server after ex

How to upload file into project folder and get its name using multer and Node.js

I need to save file into folder and want to get that file's name to save into database using Node.js.
api.js:
var multer = require('multer')
var storage =multer.diskStorage({
destination: function (req, file, callback) {
callback(null, './../uploads');
},
filename: function (req, file, callback) {
callback(null, file.fieldname + '-' + Date.now());
}
});
exports.saveCardDetails=function(upload.single('image'),req,res){
var name=req.body.name;
var company=req.body.company;
var position=req.body.position;
var mobile=req.body.mobile;
var email=req.body.email;
var landline=req.body.landline;
var url=req.body.url;
var postcode=req.body.postcode;
var address=req.body.address;
var image=req.body.image;
var userid=req.body.userid;
var profiletext=req.body.profile;
var biography=req.body.biography;
var token_id=req.body.token_id;
console.log('request',req);
}
server.js:
var express=require('express');
var morgan = require('morgan');
var http=require('http');
var bodyParser= require('body-parser');
var methodOverride = require('method-override');
var mongo = require('mongojs');
var session = require('express-session');
var app=module.exports=express();
var server=http.Server(app);
var port=8989;
var admin=require('./route/route.js');
var api=require('./api/api.js');
app.use(express.static(__dirname + '/public')); // set the static files location /public/img will be /img for users
app.use(morgan('dev')); // log every request to the console
app.use(bodyParser.urlencoded({ extended: false })) // parse application/x-www-form-urlencoded
app.use(bodyParser.json()) // parse application/json
app.post('/api/users/save-card-details',api.saveCardDetails);
After this I am getting the following error:
POST /api/users/save-card-details 413 13.277 ms - 1120
Error: request entity too large
at readStream (/opt/lampp/htdocs/heroku/FGDP/node_modules/raw-body/index.js:196:17)
at getRawBody (/opt/lampp/htdocs/heroku/FGDP/node_modules/raw-body/index.js:106:12)
at read (/opt/lampp/htdocs/heroku/FGDP/node_modules/body-parser/lib/read.js:76:3)
at urlencodedParser (/opt/lampp/htdocs/heroku/FGDP/node_modules/body-parser/lib/types/urlencoded.js:115:5)
at Layer.handle [as handle_request] (/opt/lampp/htdocs/heroku/FGDP/node_modules/express/lib/router/layer.js:95:5)
at trim_prefix (/opt/lampp/htdocs/heroku/FGDP/node_modules/express/lib/router/index.js:312:13)
at /opt/lampp/htdocs/heroku/FGDP/node_modules/express/lib/router/index.js:280:7
at Function.process_params (/opt/lampp/htdocs/heroku/FGDP/node_modules/express/lib/router/index.js:330:12)
at next (/opt/lampp/htdocs/heroku/FGDP/node_modules/express/lib/router/index.js:271:10)
at logger (/opt/lampp/htdocs/heroku/FGDP/node_modules/morgan/index.js:144:5)
Here I am getting the image and need to save into folder. After saving into folder I need saved file name into exports.saveCardDetails function. My folder structure is given below.
--> api/api.js
--> upload
I am using multer npm package for this.
Looks like multer is failing for large file size.
Try setting the fieldSize variable in multer config like this -
multer({
storage: storage,
limits: { fileSize: maxSize }
})
You can find these settings here - https://www.npmjs.com/package/multer (search for limit).
Hope this helps!

Unable to use express sessions in heroku nodejs app

In my app.js I have:
var express = require('express')
var path = require('path');
var logger = require('morgan');
var cookieParser = require('cookie-parser');
var bodyParser = require('body-parser');
var passport = require('passport');
var LocalStrategy = require('passport-local').Strategy;
var mongo = require('mongodb');
var flash = require('connect-flash');
....
app.use(logger('dev'));
app.use(bodyParser.json());
app.use(bodyParser.urlencoded({ extended: true }));
app.use(cookieParser('3mKay'));
app.use(require('stylus').middleware(path.join(__dirname, 'public')));
app.use(express.session({ secret: 'thisISmyS3cR3t'}));
This crashes with the following message in Heroku.
Error: Most middleware (like session) is no longer bundled with Express and must be installed separately. Please see https://github.com/senchalabs/connect#middleware.
at Function.Object.defineProperty.get (/app/node_modules/express/lib/express.js:89:13)
at Object.<anonymous> (/app/app.js:25:17)
at Module._compile (module.js:456:26)
at Object.Module._extensions..js (module.js:474:10)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:312:12)
at Function.Module.runMain (module.js:497:10)
at startup (node.js:119:16)
at node.js:906:3
I ran so it does exist in the package.json file as well:
npm install express-sessions --save
"dependencies": {
....
"express": "~4.8.6",
"express-session": "^1.8.1",
"passport": "^0.2.1",
"passport-local": "^1.0.0",
....
It works fine when I comment out the
app.use(express.session({ secret: 'thisISmyS3cR3t'}));
And I've also tried variations of the above but it gives the same error message. Any ideas what may be causing this to happen? Something I might have overlooked...
Once you install it, you have to actually use it in your code:
var express = require('express');
var session = require('express-session');
var path = require('path');
var logger = require('morgan');
var cookieParser = require('cookie-parser');
var bodyParser = require('body-parser');
var passport = require('passport');
var LocalStrategy = require('passport-local').Strategy;
var mongo = require('mongodb');
var flash = require('connect-flash');
....
app.use(logger('dev'));
app.use(bodyParser.json());
app.use(bodyParser.urlencoded({ extended: true }));
app.use(cookieParser('3mKay'));
app.use(require('stylus').middleware(path.join(__dirname, 'public')));
app.use(session({ secret: 'thisISmyS3cR3t'}));

Resources