{"size": 883, "ext": "js", "max_stars_repo_path": "app.js", "max_stars_repo_name": "trycrmr/mern-todo-app", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "app.js", "max_issues_repo_name": "trycrmr/mern-todo-app", "max_issues_repo_issues_event_min_datetime": "2021-09-02T10:18:21.000Z", "max_issues_repo_issues_event_max_datetime": "2022-02-19T05:26:05.000Z", "max_forks_repo_path": "app.js", "max_forks_repo_name": "trycrmr/mern-todo-app", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": null, "max_issues_count": 3, "max_forks_count": null, "avg_line_length": 26.7575757576, "max_line_length": 128, "alphanum_fraction": 0.7010192525}
import path from "path";
import express from "express";
import webpack from "webpack";
import gqlServer from "./graphqlServer.js";
import { setConfig } from "react-hot-loader";

const PORT = 3000;

const router = require("./routes/index");
const webpackConfig = require("./webpack.config.js");

setConfig({ logLevel: "debug" });
const compiler = webpack(webpackConfig);
const app = express();

gqlServer.applyMiddleware({ app });

app.use(
  require("webpack-dev-middleware")(compiler, {
    noInfo: true,
    publicPath: webpackConfig.output.publicPath,
  })
);
app.use(require("webpack-hot-middleware")(compiler));
app.use("/dist", express.static(path.join(__dirname, "dist")));
app.use("/", router);

app.listen(PORT, () => {
  console.info(
    `Listening on port ${PORT}. Running as a ${process.env.NODE_ENV} environment. GraphQL available at ${gqlServer.graphqlPath}`
  );
});
