Skip to content

Instantly share code, notes, and snippets.

@lakshaygupta21
Created May 13, 2020 06:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lakshaygupta21/3ea2b6090bea293fa0388ace5685465c to your computer and use it in GitHub Desktop.
Save lakshaygupta21/3ea2b6090bea293fa0388ace5685465c to your computer and use it in GitHub Desktop.
var express = require('express')
var app = express();
var App = require('./app.js')
var bodyParser = require('body-parser')
app.use(bodyParser.urlencoded({
extended: true
}))
app.get('/', function (req, res) {
res.render('home.ejs');
})
app.get('/reports', function (req, res) {
res.render('reportsPage.ejs', {
settlementdata: App.settlement,
performancedata: App.performance,
inventorydata: App.inventory,
orderdata: App.order,
amazonpaydata: App.amazonpay
})
})
try {
app.post('/', function (req, res) {
new App.RequestReports(req.body.aws_key, req.body.aws_secret_key, req.body.seller_id, req.body.mws_auth_token, req.body.seller_name, new Date(req.body.start_date).toISOString(), new Date(req.body.end_date).toISOString())
res.render('loading.ejs', {
settlementdata: App.settlement,
performancedata: App.performance,
inventorydata: App.inventory,
orderdata: App.order,
amazonpaydata: App.amazonpay
})
})
} catch (err) {
console.log("Error")
}
app.listen(3000/*process.env.PORT*/, process.env.IP, function () {
console.log("Server started")
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment