? ?? Node.js? Express.js? ???? ????? ???? ??? ??? ??? ????. Express.js? Node.js? ???? ???? ?? ??? ? ??????? ??? ? ???? ????????. ??? ???, ????, ??? ?? ? ?? ??.
?? ?????:- app.use(??)
- app.use(??, ??)
- GET, POST, PUT, DELETE
- ????? ????
- ???? ?? ???? ??
- ????? ??? ??
- ?? ?? ?? ????
- ??? ??
- EJS
Express.js? app.use(callback) ???? ???? ??? ???? ? ?????. ? ????? HTTP ???? URL? ???? ??????? ?? ?? ??? ???? ?????.
?) ? ??? ????? ???? ?? ??? ???? ???? ??? ???? ?????.
const express = require('express'); const app = express(); app.use((req, res, next) => { console.log('Middleware running for every request.'); next(); });2. app.use(??, ??)
? ??? ???? ?? ??? ????? ???? ? ????. ????? ??? ??? ??? ???? ???? ?????.
?) ? ???? /users? ???? ??? ???? ????? ??????.
app.use('/users', (req, res, next) => { console.log('Middleware only for /users route.'); next(); });3. ??, ????, ??, ????
??? ???? ???? ?? ???? ?? HTTP ???(GET, POST, PUT, DELETE ?)? ??? ? ????. ???? ? ??????? ??? ?????.
?) ? ???? ??? ??? ?? CRUD ??(??, ??, ????, ??)? ?? ??? ?????.
app.get('/users', (req, ress) => { res.send('Fetching all users'); }); app.post('/users', (req, res) => { res.send('Creating a new user'); }); app.put('/users/:id', (req, res) => { res.send(`Updating user with ID: ${req.params.id}`); }); app.delete('/users/:id', (req, res) => { res.send('Deleting user with ID: ${req.params.id}`); });4. ????? ????
Express.js? ???? ??? ??(req) ? ??(res) ??? ???? ? ??? ??? ????? ????? ??-?? ??? ??? ? ????.
?? ??:
- ?? ??: ?? ??? ??? ??? ? ????.
- ??/?? ??: ????? ??? ???????, req? ???? ?????, res ??? ??? ? ????.
- ??-?? ?? ??: ????? ???? ?????? ?? ??? ??? ??? ? ????.
?) ? ??? ????? ?? ??? ??? ?? ???? ???? ?? ???? ?? ??????.
app.use((req, res, next) => { req.customData = 'Some custom data'; next(); }); app.get('/', (req, res) => { res.send(`Data from middleware: ${req.customData}`); });5. ?? ???? ??
?? ???? next()? ???? ?? ????? ?? ???? ???? ??????. next()? ???? ??? ??? ??? ???? ?? ??? ??? ?????.
?) ??? ?? ? ???? ??? ??? ?? ???? ???? ??? ? ????.
const express = require('express'); const app = express(); app.use((req, res, next) => { console.log('Middleware running for every request.'); next(); });
6. ????? ??? ????
Express Router? ??? ???????? ??? ???? ? ??? ?????. ??? ? ?? ?? ??? ???? ??? ? ??? ???.
?) ? ??? ???? /users? ????? /users/profile? ?? ??? ???? ??? ?? ?????.
app.use('/users', (req, res, next) => { console.log('Middleware only for /users route.'); next(); });
7. ?? ?? ?? ????
??? ?? ? ??? ????? ??? ??? ???? ?? ?????. Express.js? ?? ???? ???? ?? ????? ?????.
?) express-session? ???? ??? ????? ?? ???? ?????, ?? ??? ?? ??? ?? ?? ?????.
app.get('/users', (req, ress) => { res.send('Fetching all users'); }); app.post('/users', (req, res) => { res.send('Creating a new user'); }); app.put('/users/:id', (req, res) => { res.send(`Updating user with ID: ${req.params.id}`); }); app.delete('/users/:id', (req, res) => { res.send('Deleting user with ID: ${req.params.id}`); });
8. ??? ??
??? ??? ???? ?? ???? ? ??? ???? ???? ???? ??? ? ????. ?? ?? EJS??? ???? ?? ?? ??? ??? ? ????.
?) ? ???? ??? ??? ??? EJS ???? ?????.
app.use((req, res, next) => { req.customData = 'Some custom data'; next(); }); app.get('/', (req, res) => { res.send(`Data from middleware: ${req.customData}`); });
9. EJS(???? ??????)
EJS? HTML? ???? HTML ?? ?? ?? JavaScript? ??? ? ?? ?? ?? ??? ?????. ????? ???? Express.js? ? ???? ?? ????? ?????.
?) <%= %> ??? JavaScript ???? HTML? ???? ? ?????.
app.use((req, res, next) => { console.log('First middleware'); next(); }); app.use((req, res, next) => { console.log('Second middlware'); });
? ??? Node.js? Express.js? ???? ????? ?? ?????. ??? ??? 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)

JavaScript? ??? ?? ????? ??? ?? ??? ??? ?? ?? ?? ????? ?? ???? ???? ?????. ??? ?? ???? ?? ??? ?? ??? ???? ???? ?? ?? ???? ???? ?????. ?? ??, ??? ? ?? ???? ??? (? : ??? null? ??) ?? ??? ????? ??????. ??? ??? ???? ??? ??? ????. closure?? ?? ??? ?? ??; ? ??? ??? ?? ?? ???? ?? ???? ????. V8 ??? ?? ???, ?? ??, ??/?? ???? ?? ??? ?? ??? ??? ????? ?? ??? ?? ??? ????. ?? ?? ???? ??? ??? ??? ??? ???? ????? ?? ?? ???? ?? ???????.

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? ????? ???? ?????.

iife (?? invokedfunctionexpression)? ?? ??? ???? ?? ????? ??? ???? ?? ??? ????? ?? ??? ? ?????. ??? ?? ?? ??? ???? ? ?? ??? ??? ?? (function () {/code/}) ();. ?? ???? ??? ?????. 1. ?? ??? ??? ?? ???? ?? ??? ??? ?????. 2. ?? ??? ??? ???? ?? ?? ??? ????. 3. ?? ?? ??? ????? ?? ???? ???????? ?? ? ??. ???? ?? ???? ?? ??? ES6 ??? ??? ??? ?? ? ??? ????? ??? ? ???? ???????.

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

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