如何使用 MERN 堆栈构建动态单页 Web 应用程序?
How to build a dynamic single page web app using MERN stack?
我阅读了很多关于使用(ejs、handelbars 等)使用 express js 创建动态应用程序的文章,但我希望我的网络应用程序通过使用 react 是动态的和单页的。
我的目的是呈现模板并插入来自快速服务器的动态数据以响应单页应用程序以使我的应用程序更快,有没有办法使用 MERN 堆栈来做到这一点?
当然有办法做到这一点,这就是 MERN 的用途:
M: Mongodb is for database and you should npm install mongoose,
mongoose is a great npm library for dealing with mongodb
E: Expressjs is a framework to make web application (send
get/post/put/delete.. requests and much other stuff) on Nodejs
R: Reactjs for your frontend as you know
N: Nodejs as they mention it on their web site; 'javascript on the
server' for the backend
如果你想创建一个单页应用程序,你所要做的就是设置你的数据库(如果你需要的话),然后使用 nodejs 和 expressjs 编写你的后端代码,一旦完成就使用 [=35 午餐后端=]yarn start 或 node app.js 随心所欲,最后使用 create-react-app[=39 打开一个 React 项目=] 命令(这是一个 npm 包,所以你必须先使用 npm i -g create-react-app 安装它)完成前端设置后,你可以从中检索数据在你的反应代码中使用 axios 支持。一切都会好起来的。
以下文章可能对您有所帮助:
How to create your first MERN (MongoDB, Express JS, React JS and Node JS) Stack
Let’s build a full stack MongoDB, React, Node and Express (MERN) app
The MERN Stack Tutorial – Building A React CRUD Application From Start To Finish – Part 1
The MERN Stack Tutorial — Building A React CRUD Application From Start To Finish — Part 2
The MERN Stack Tutorial – Building A React CRUD Application From Start To Finish – Part 3
The MERN Stack Tutorial – Building A React CRUD Application From Start To Finish – Part 4
我阅读了很多关于使用(ejs、handelbars 等)使用 express js 创建动态应用程序的文章,但我希望我的网络应用程序通过使用 react 是动态的和单页的。
我的目的是呈现模板并插入来自快速服务器的动态数据以响应单页应用程序以使我的应用程序更快,有没有办法使用 MERN 堆栈来做到这一点?
当然有办法做到这一点,这就是 MERN 的用途:
M: Mongodb is for database and you should npm install mongoose, mongoose is a great npm library for dealing with mongodb
E: Expressjs is a framework to make web application (send get/post/put/delete.. requests and much other stuff) on Nodejs
R: Reactjs for your frontend as you know
N: Nodejs as they mention it on their web site; 'javascript on the server' for the backend
如果你想创建一个单页应用程序,你所要做的就是设置你的数据库(如果你需要的话),然后使用 nodejs 和 expressjs 编写你的后端代码,一旦完成就使用 [=35 午餐后端=]yarn start 或 node app.js 随心所欲,最后使用 create-react-app[=39 打开一个 React 项目=] 命令(这是一个 npm 包,所以你必须先使用 npm i -g create-react-app 安装它)完成前端设置后,你可以从中检索数据在你的反应代码中使用 axios 支持。一切都会好起来的。
以下文章可能对您有所帮助:
How to create your first MERN (MongoDB, Express JS, React JS and Node JS) Stack
Let’s build a full stack MongoDB, React, Node and Express (MERN) app
The MERN Stack Tutorial – Building A React CRUD Application From Start To Finish – Part 1
The MERN Stack Tutorial — Building A React CRUD Application From Start To Finish — Part 2
The MERN Stack Tutorial – Building A React CRUD Application From Start To Finish – Part 3
The MERN Stack Tutorial – Building A React CRUD Application From Start To Finish – Part 4