API(?????? ????? ?????)? ?? ? ??????? ????, ?????? ??? ?? ??? ???? ???. JavaScript? API? ???? ? ?? ?? ???? ?? ? ??? ????? ??? Node.js ?????? Express.js???. ? ???? Express.js? ???? API? ???? ?? ??? ?????.
Express.js? ??????
Express.js? Node.js? ?? ? ??????? ???? ?? ?? ????????. HTTP ?? ??, ???, ???? ??? ?? ??? ?????? API ??? ??? ?????.
Express.js? ???? ??
- ?? ???: ??? ??? ?? ??.
- ???: ????? ??? ???? ??, ??, ?? ?? ?? ??? ??? ? ????.
- ???: ??? ? ??? ?????? ??? ?????.
Express.js ?? ??
1??: Node.js ??
Node.js? ???? ??? ?????. ??? ?? nodejs.org?? ???????.
2??: ???? ???
? ???? ????? ???? ??????.
mkdir express-api cd express-api npm init -y
??? ???? ???? ?? package.json ??? ?????.
3??: Express.js ??
npm? ???? Express.js? ?????.
npm install express
? ?? API ??
1??: ?? ?? ??
?? server.js ??? ??? ?? ??? ?????.
const express = require('express'); const app = express(); const PORT = 3000; app.listen(PORT, () => { console.log(`Server is running on http://localhost:${PORT}`); });
??? ???? ??? ?????.
node server.js
http://localhost:3000? ???? ??? ?? ?? ?? ? ? ????(?? ???? ???? ???).
2??: ? ?? ?? ??
??? API? ????? ??? ???? ??? ?????. ?? ???? ???? ??? ??? ?????:
app.get('/', (req, res) => { res.send('Welcome to your first Express API!'); });
??? ?? ???? http://localhost:3000? ???? ?? ???? ?????.
3??: API ????? ??
???? ??? ?????? ??? ?????. ?? ?? ??? ??? ???? /users ??? ??? ????.
const users = [ { id: 1, name: 'Alice' }, { id: 2, name: 'Bob' }, { id: 3, name: 'Charlie' } ]; app.get('/users', (req, res) => { res.json(users); });
?? http://localhost:3000/users? ???? ??? ???? JSON ???? ?????.
???? ??
Express.js? ???? ??? ??? ??? ?????. ?? ?? ????? ???? ?????? ?? JSON ???? ?? ??? ? ????.
1??: ?? ???? ??
JSON ?? ??? ?????? ??? ?????.
app.use(express.json());
2??: POST ?? ??
? ???? ????? ??? ?????.
mkdir express-api cd express-api npm init -y
?? JSON ???? ??? POST ??? http://localhost:3000/users? ?? ? ???? ??? ? ????.
?? ??
??? ???? ????? ????? ?????. ?:
npm install express
??? ?? ???? ?? ??? ?? ?? ??? ????? ?????.
?? ??
?? ?? ??? ????.
const express = require('express'); const app = express(); const PORT = 3000; app.listen(PORT, () => { console.log(`Server is running on http://localhost:${PORT}`); });
??
Express.js? API ??? ???? ????? ??? ??? ???? ? ??? ??? ???? ?????. ?? ??, ??? ??, ???? ??? ?? ??? ???? ? ??????? ?? ??? API? ?? ? ????.
??, ?????? ??, ?? ?? ?? ?? ??? ?? ???? API? ? ?? ? ??????!
? ??? Express.js? ??? API ??? ?? ??? ???? ?? ?????. ??? ??? PHP ??? ????? ?? ?? ??? ?????!

? AI ??

Undress AI Tool
??? ???? ??

Undresser.AI Undress
???? ?? ??? ??? ?? AI ?? ?

AI Clothes Remover
???? ?? ???? ??? AI ?????.

Clothoff.io
AI ? ???

Video Face Swap
??? ??? AI ?? ?? ??? ???? ?? ???? ??? ?? ????!

?? ??

??? ??

???++7.3.1
???? ?? ?? ?? ???

SublimeText3 ??? ??
??? ??, ???? ?? ????.

???? 13.0.1 ???
??? PHP ?? ?? ??

???? CS6
??? ? ?? ??

SublimeText3 Mac ??
? ??? ?? ?? ?????(SublimeText3)

Node.js?? HTTP ??? ???? ? ?? ???? ??? ????. 1. ?? ????? ????? ??? ??? ? ?? ????? ?? ?? ? https.get () ??? ?? ??? ??? ? ?? ????? ?? ??? ?????. 2.axios? ??? ???? ? ?? ??????. ??? ??? ??? ??? ??? ??? ???/???, ?? JSON ??, ???? ?? ?????. ??? ?? ??? ????? ?? ????. 3. ?? ??? ??? ??? ??? ???? ???? ??? ??? ???? ?????.

JavaScript ??? ??? ?? ?? ? ?? ???? ????. ?? ???? ???, ??, ??, ?, ???? ?? ? ??? ?????. ?? ????? ?? ?? ? ? ??? ????? ?? ??? ??? ????. ??, ?? ? ??? ?? ?? ??? ??? ??? ???? ??? ??? ???? ??? ?? ??? ????. ?? ? ????? ??? ???? ? ??? ? ??? TypeofNull? ??? ?????? ??? ? ????. ? ? ?? ??? ???? ?????? ????? ???? ??? ???? ? ??? ? ? ????.

?? JavaScript ??? ??? ??? ?????? ?? ??? ?? ?? ??? ?? ???? ????. 1. ??? ???? ???? ?? ??? ?? ? ? ???? ??? ??? ?? ? ?? ????? ?????. 2. Angular? ?????? ??? ?? ???? ? ?? ?? ??? ??? ??? ???? ?????. 3. VUE? ???? ?? ??? ???? ?? ?? ??? ?????. ?? ?? ?? ??, ? ??, ???? ???? ? SSR? ???? ??? ??? ??? ???? ? ??? ?????. ???, ??? ??? ??? ????? ????. ??? ??? ??? ??? ?? ????.

?????, JavaScript ???! ?? ? JavaScript ??? ?? ?? ?????! ?? ?? ??? ??? ??? ? ????. Deno?? Oracle? ?? ??, ??? JavaScript ?? ??? ????, Google Chrome ???? ? ??? ??? ???? ?????. ?????! Deno Oracle? "JavaScript"??? ????? Oracle? ?? ??? ??? ??????. Node.js? Deno? ??? ? Ryan Dahl? ??? ?????? ???? ????? JavaScript? ??? ???? Oracle? ????? ???? ?????.

Cacheapi? ?????? ?? ???? ??? ???? ???, ?? ??? ??? ?? ???? ? ??? ?? ? ???? ??? ??????. 1. ???? ????, ??? ??, ?? ?? ?? ???? ???? ??? ? ????. 2. ??? ?? ?? ??? ?? ? ? ????. 3. ?? ?? ?? ?? ?? ??? ??? ?? ?????. 4. ??? ???? ?? ?? ???? ?? ?? ?? ?? ?? ???? ?? ?? ??? ??? ? ????. 5. ?? ???? ??, ??? ??? ? ??? ??, ?? ??? ? ?? ???? ???? ???? ? ?? ?????. 6.?? ??? ?? ?? ?? ??, ???? ?? ? HTTP ?? ????? ?????? ???????.

??? JavaScript?? ??? ??? ?????? ?? ???????. ?? ??, ?? ?? ? ??? ??? ?? ????? ????? ?????. 1. ?? ??? ??? ????? ???? ??. ()? ?? ??? ??? ?????. ?. ()? ?? ??? ?? ??? ??? ?? ? ? ????. 2. ?? ??? .catch ()? ???? ?? ??? ??? ?? ??? ??????, ??? ???? ???? ????? ??? ? ????. 3. Promise.all ()? ?? ????? (?? ?? ?? ? ??????? ??), Promise.Race () (? ?? ??? ?? ?) ? Promise.AllSettled () (?? ??? ???? ??)

.map (), .filter () ? .reduce ()? ?? JavaScript ?? ?? ???? ??? ??? ??? ? ? ????. 1) .map ()? ??? ??? ??? ???? ? ??? ???? ? ?????. 2) .filter ()? ???? ??? ????? ? ?????. 3) .reduce ()? ???? ?? ??? ???? ? ?????. ???? ??? ????? ??? ?? ?? ??? ?????.

JavaScript? ??? ??? ?? ??, ? ? ? ?? ???? ???? ??? ??? ?????. 1. ?? ??? ?? ??? ???? ??? ??? ??? ??? ?? WebAPI? ?????. 2. WebAPI? ??????? ??? ?? ? ? ??? ?? ??? (??? ?? ?? ???? ??)? ????. 3. ??? ??? ?? ??? ?? ??? ?????. ?? ??? ??? ????? ??? ??? ?? ? ???? ?????. 4. ???? ?? (? : Promise. 5. ??? ??? ???? ?? ???? ???? ?? ?? ?? ??? ????? ? ??????.
