随笔分类 - Node JS
Defining RESTful Routes(CRUD operations)
摘要:。
const methodOverride = require('method-override')
const { v4: uuid } = require('uuid'); //For generating ID's
// To 'fake' put/patch/delete requests:
app.use(methodOverride('_method'))
阅读全文
EJS interpolation syntax : pass data to templates
摘要:在ejs文件中使用js的数学公式,生成随机数字。 <%= Math.floor(Math.random()*10) + 1 %> res.render('random.ejs', {bubble: num}) <%= bubble %>
阅读全文
Creating Servers with Express
摘要:Request & Response Objects; Express Routing Basics; Express Path Parameters; Working With Query Strings; Auto-Restart With Nodemon
阅读全文
configuring express for ejs
摘要:app.set('view engine', 'ejs'); res.render('home.ejs') ; setting the views directory; const path = require('path'); app.set('views', path.join(__dirname, '/views')) //__dirname is where index.js is located
阅读全文
The NPM(Node Package Manager) Universe
摘要:npm i colors; npm i -g cowboy; npm init; npm install; npm link cowsay(adding global package: cowsay)
阅读全文
Node js Intro
摘要:node xx.js; process.argv; Use file system to creat folder and files; const fs = require('fs'); mkdirSync; writeFileSync
阅读全文
浙公网安备 33010602011771号