-
(Frontend linter init settings for React) ntuee-web-programming/112-1-unit1-trello-clone
-
ntuee-web-programming/112-1-unit1-todo-list// DEPRECATED
If you only want to run the project, you can follow the steps below.
Please find the .zip
download link of HW1: My Diary
at https://wp.ee.ntu.edu.tw/.
cd backend
yarn
yarn start
Open frontend/index.html
by clicking it in your file explorer.
Or if you're on ubuntu, you can run the following command to open it in your browser.
cd frontend
xdg-open index.html
If you're on macOS, you can run the following command to open it in your browser.
cd frontend
open index.html
要用 const
來保證這個 method 沒有 side effects,即不會更動到 caller。
const { title, description } = req.body;
// equals to
const title = req.body.title;
const description = req.body.description;
因此,只要前端打過來的是,例如:…/api/todos/12345,那 id 就會收到 12345
其實應該可以用 async/await
,老師說之後示範。
[前端筆記] 使用 Node.js 時噴錯 -Error: listen EADDRINUSE: address already in use 127.0.0.1:3000 | by Bonnie Wang | Medium
- lint 的部分應該放在 setup 後面?
- 這裡 merge 有問題
$ yarn create vite
yarn create v1.22.17
✔ Project name: … frontend
✔ Select a framework: › React
✔ Select a variant: › TypeScript
cd frontend
yarn
yarn dev
mkdir backend
cd backend
yarn init -y
yarn add express cors mongoose dotenv body-parser
yarn add -D ts-node typescript @types/cors @types/node @types/express
-D
: dev only
Then we create a tsconfig.json
file
yarn tsc --init
mkdir src
touch src/index.ts
"scripts": {
"dev": "nodemon src/index.ts",
"start": "ts-node src/index.ts",
"lint": "eslint src",
"format": "prettier --write src"
}
Add the following line to tsconfig.json
. Now we can import from @lib/*
instead of ../../../lib/*
.
{
"compilerOptions": {
...
"@lib/*": ["../lib/*"], // <--- Do NOT add this line
// Use This Instead // ISSUE
"paths": {
"@lib/*": ["../lib/*"]
}
...
}
}