MERN stands for MongoDB, Express, React, and Node.js.
第十章 - CRA專案與Dynamic Style Injection
PS C:\\Users\\user\\OneDrive\\桌面\\mern> npx create-react-app client --template typescript
perform operations on the api folder:
npm init -y
npm i express
npm i mongoose
npm i dotenv
npm i nodemon

create
index.jsfile (not ts)
{
"name": "api",
"version": "1.0.0",
"description": "",
"main": "index.js",
"type": "module",
"scripts": {
"start": "nodemon index.js"
},
"keywords": [],
"author": "",
"license": "ISC",
"dependencies": {
"dotenv": "^17.2.3",
"express": "^5.2.1",
"mongoose": "^9.0.2",
"nodemon": "^3.1.11"
}
}
go to mongodb/cloud/atlas/register register and sign in
- Create the project “mern”

- Create a user in Security Quickstart (remenber your password)

- Set the address to
0.0.0.0for localhost

- Go to clusters/Browse Collections

- click Create database

- Create database
- back to cluster / connect / drivers, copy the application code


.envMONGODB = mongodb+srv://hchen1029_db_user:[email protected]/Database_Name
appName=Cluster1