💎一站式轻松地调用各大LLM模型接口,支持GPT4、智谱、星火、月之暗面及文生图 广告
``` //引包 (核心模块) var http = require('http'); var fs = require('fs'); // (第三方模块) var localData = require('./data.js'); var server = http.createServer(); server.on('request', function (req, res) { console.log(req.url); if(req.url === '/') { // res.setHeader('Access-Control-Allow-Origin', '*'); res.setHeader('Access-Control-Allow-Origin', 'http://192.168.22.2'); res.setHeader('Content-Type', 'text/plain; charset=utf-8'); res.end(JSON.stringify(localData.data)); } else if (req.url.indexOf('/images/') === 0) { fs.readFile('.' + req.url + '.jpg', function (err, data) { res.end(data); }) } }); server.listen(3030, function () { console.log('server is running'); }) ```