Skip to content

Instantly share code, notes, and snippets.

@saitjr
Last active May 14, 2019 03:51
Show Gist options
  • Save saitjr/55bad8dc13ba72f3407470b65891c62d to your computer and use it in GitHub Desktop.
Save saitjr/55bad8dc13ba72f3407470b65891c62d to your computer and use it in GitHub Desktop.
nodejs test api
// mkdir test-node; cd test-node; touch app.js; npm init -y
// 安装:npm install --save express nodemon body-parser
// 执行:nodemon app
var express = require('express');
var app = express();
app.get('/api', (req, res, next) => {
res.send(req.query);
});
app.listen(3000);
// 访问:curl http://localhost:3000/api?a=1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment