In this post we will setup app.js file to make app running first write below code below -> import express from "express" import cors from "cors" import morgan from "morgan" const app = express () app. use ( cors ()) app. use ( express . json ()) app. use ( morgan("dev") ) app. get ( '/' , ( req , res ) => { res . json ({message: "CMS Backend API Running." }) }) export default app and save express.json() — JSON body parse karta hai cors() — frontend (Next.js) ko API call karne deta hai morgan("dev") — console me request logs dikhata hai Base route / — test karne ke liye ready hai
First check responsiveness of theme using inspect. Then add viewport meta for make theme responsive like below -> In head section add below code < meta name = "viewport" content = "width=device-width, initial-scale=1" > Now add charset in Head section like below < meta charset = " <?php bloginfo ( 'charset' ) ? > " > and now add language attribute in <html> like below < html <?php language_attributes (); ? > > and save check the blog in inspect viewport. After add new function in <body> like below < body <?php body_class (); ? > > and save.
In this post we will setup server.js file for our node js application. First go to backend/src/server.js file and write below code. -> import dotenv from "dotenv" import app from "./app.js" //because in package.json me type:module hai dotenv. config () const PORT = process.env.PORT || 5000 app. listen (PORT, () => { console. log ( `Server running on http://localhost: ${ PORT } ` ) }) and save
Comments
Post a Comment