From 50e78f8d836bd1d3271563d220b03e369bc175df Mon Sep 17 00:00:00 2001 From: sk Date: Sat, 26 Aug 2023 11:12:43 +0530 Subject: [PATCH] work --- next.config.js | 3 +++ package.json | 5 +++-- server.js | 40 ---------------------------------------- 3 files changed, 6 insertions(+), 42 deletions(-) delete mode 100644 server.js diff --git a/next.config.js b/next.config.js index 9b89440..4a7a72c 100644 --- a/next.config.js +++ b/next.config.js @@ -3,9 +3,12 @@ const nextConfig = { // output: "export", // reactStrictMode: true, // swcMinify: true, + // experimental: { images: { unoptimized: true, }, + // }, + // trailingSlash: true, }; module.exports = nextConfig; diff --git a/package.json b/package.json index a141c22..12a1029 100644 --- a/package.json +++ b/package.json @@ -3,9 +3,10 @@ "version": "0.1.0", "private": true, "scripts": { - "dev": "node server.js", + "dev": "next dev", "build": "next build", - "start": "NODE_ENV=production node server.js" + "start": "next start", + "lint": "next lint" }, "dependencies": { "@types/node": "20.5.4", diff --git a/server.js b/server.js deleted file mode 100644 index 0518145..0000000 --- a/server.js +++ /dev/null @@ -1,40 +0,0 @@ -const { createServer } = require("http"); -const { parse } = require("url"); -const next = require("next"); - -const dev = process.env.NODE_ENV !== "production"; -const hostname = "localhost"; -const port = 3000; -// when using middleware `hostname` and `port` must be provided below -const app = next({ dev, hostname, port }); -const handle = app.getRequestHandler(); - -app.prepare().then(() => { - createServer(async (req, res) => { - try { - // Be sure to pass `true` as the second argument to `url.parse`. - // This tells it to parse the query portion of the URL. - const parsedUrl = parse(req.url, true); - const { pathname, query } = parsedUrl; - - if (pathname === "/a") { - await app.render(req, res, "/a", query); - } else if (pathname === "/b") { - await app.render(req, res, "/b", query); - } else { - await handle(req, res, parsedUrl); - } - } catch (err) { - console.error("Error occurred handling", req.url, err); - res.statusCode = 500; - res.end("internal server error"); - } - }) - .once("error", (err) => { - console.error(err); - process.exit(1); - }) - .listen(port, () => { - console.log(`> Ready on http://${hostname}:${port}`); - }); -});