Commit 9d0ed739 authored by Nawasan Wisitsingkhon's avatar Nawasan Wisitsingkhon

initial commit with setup project

parent ead996ad
import { Request, Response } from "express";
const WelcomeController = {
/**
*
* @param { Request } req
* @param { Response } res
*/
index(req, res) {
res.json({
message: "welcome to my api",
});
},
};
export default WelcomeController;
import express from "express";
import WelcomeController from "../controllers/WelcomeController";
const route = express.Router();
route.get("/", WelcomeController.index);
route.get("/users", (req, res) => {
res.json({
name: "Nawasan",
age: 21,
});
});
export default route;
/** @type {import('next').NextConfig} */
const nextConfig = {
async rewrites() {
return [
{
source: "/api/:path*",
destination: "/api/main",
},
];
},
reactStrictMode: true,
}
};
module.exports = nextConfig
module.exports = nextConfig;
......@@ -9,15 +9,16 @@
"lint": "next lint"
},
"dependencies": {
"express": "^4.18.2",
"next": "latest",
"react": "latest",
"react-dom": "latest",
"next": "latest"
"react-dom": "latest"
},
"devDependencies": {
"autoprefixer": "latest",
"postcss": "latest",
"tailwindcss": "latest",
"eslint": "latest",
"eslint-config-next": "latest"
"eslint-config-next": "latest",
"postcss": "latest",
"tailwindcss": "latest"
}
}
This diff is collapsed.
// Next.js API route support: https://nextjs.org/docs/api-routes/introduction
import express from "express";
import route from "../../../backend/routes/web";
const app = express();
export default function handler(req, res) {
res.status(200).json({ name: 'John Doe' })
}
app.use("/api/", route);
export default app;
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment