我的node项目首次提交!!!

This commit is contained in:
heiye111
2025-09-20 22:05:58 +08:00
commit 48600edffc
2539 changed files with 365006 additions and 0 deletions

29
node_modules/find-my-way/example.js generated vendored Normal file
View File

@@ -0,0 +1,29 @@
'use strict'
const http = require('http')
const router = require('./')({
defaultRoute: (req, res) => {
res.end('not found')
}
})
router.on('GET', '/test', (req, res, params) => {
res.end('{"hello":"world"}')
})
router.on('GET', '/:test', (req, res, params) => {
res.end(JSON.stringify(params))
})
router.on('GET', '/text/hello', (req, res, params) => {
res.end('{"winter":"is here"}')
})
const server = http.createServer((req, res) => {
router.lookup(req, res)
})
server.listen(3000, err => {
if (err) throw err
console.log('Server listening on: http://localhost:3000')
})