How to convert express app to electron app


#1

This is my app.js(express app) . How can i change it to electron app?

var createError = require(‘http-errors’);
var express = require(‘express’);
var app = express();
var path = require(‘path’);
var cookieParser = require(‘cookie-parser’);
var logger = require(‘morgan’);
var session = require(‘express-session’);
var passport = require(‘passport’);
var LocalStrategy = require(‘passport-local’).Strategy;
var multer = require(‘multer’);
var upload = multer({dest:’./upload’});
var flash = require(‘connect-flash’);
var mongo = require(‘mongodb’);
var mongoose = require(‘mongoose’);

var db=mongoose.connection;

var indexRouter = require(’./routes/index’);
var usersRouter = require(’./routes/users’);

var app = express();

// view engine setup
app.set(‘views’, path.join(__dirname, ‘views’));
app.set(‘view engine’, ‘ejs’);

app.use(logger(‘dev’));
app.use(express.json());
app.use(express.urlencoded({ extended: false }));
app.use(cookieParser());
app.use(express.static(path.join(__dirname, ‘public’)));
app.use(express.static(path.join(__dirname,‘controller’)));

//Handle session

app.use(session({
secret:‘secret’,
saveUninitialized:true,
resave:true,

}));

//Passport
app.use(passport.initialize());
app.use(passport.session());

app.use(require(‘connect-flash’)());
app.use(function (req, res, next) {
res.locals.messages = require(‘express-messages’)(req, res);
next();
});

app.use(’/’, indexRouter);
app.use(’/users’, usersRouter);

//app.listen(2000,()=>{
// console.log(‘server running at port : 2000’);
//});

module.exports = app;