Last active
May 14, 2019 03:51
-
-
Save saitjr/55bad8dc13ba72f3407470b65891c62d to your computer and use it in GitHub Desktop.
nodejs test api
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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