javascript CRUD请求表达

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了javascript CRUD请求表达相关的知识,希望对你有一定的参考价值。

var express = require('express');
var router = express.Router();


/* GET users listing. */
router.get('/', function(req, res, next) {
  res.send('Hey ! It\'s a GET');
});

/* GET user with ID. */
router.get('/:id(\\d+)', function(req, res, next) {
  res.send('Hey ! It\'s a GET with ID ' + req.params.id);
});

/* POST user creation. */
router.post('/', function(req, res, next) {
  res.send('Hey ! It\'s a POST');
});

router.put('/:name', function(req, res, next) {
  res.send('Hey my name is ' + req.params.name)
  
});

router.delete('/:id', function(req, res, next) {
  res.send(`Hey it's a delete ID ' ${req.params.id}`)
  
});

module.exports = router;

以上是关于javascript CRUD请求表达的主要内容,如果未能解决你的问题,请参考以下文章

javascript nodejs-crud实践

javascript 简单的CRUD Express / NodeJS

javascript 实时MERN CRUD DOCKER

javascript CRUD在州

javascript 帆船中的CRUD +

javascript API CRUD AUTH JWT