npm start server code example

Example 1: srart server js

require('dotenv').config();

const express = require('express');
const server = express();
const cors = require('cors');
const ejs = require('ejs');
const methodOverride = require('method-override');
const pg = require('pg');
const agent = require('superagent');

const client = new pg.Client(process.env.DATABASE_URL);

server.use(methodOverride('_method'));
server.use(express.static('./public'));
server.use(cors());
server.use(express.urlencoded({extended :true}));
server.set('view engine','ejs');

Example 2: npm start using old files

this is most likely to be a problem in my code. this time I used named import
whereas I as trying to do default export. and rce also made export class something
which i forgot to remove. so there was no problem with the react-script