swagger for Mac install local

本文详细介绍了在Mac上安装和配置Swagger编辑器及UI的步骤,包括下载node.js,克隆Swagger编辑器和UI仓库,使用http-server运行编辑器,以及通过Express设置本地服务器。还提供了解决常见错误的方法和Swagger的学习资源。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

swagger for Mac install

1、去node官网下载node.js
2、git clone https://github.com/swagger-api/swagger-editor/releases
3、npm install -g http-server
4、启动Swagger-Editor项目

http-server swagger-editor 以8080端口启动项目

http-server –p 8082 swagger-editor 指定端口启动项目

http-server -p 8081 swagger-editor-3.0.17

5、git clone https://github.com/swagger-api/swagger-ui.git
6、安装express

mkdir node_app

cd node_app

npm init
(可自行填写)

npm install express --save

vi index.js

var express = require('express');
var app = express();
app.use('/static', express.static('public'));
app.get('/', function (req, res) {
  res.send('Hello World!');
});

app.listen(3000, function () {
  console.log('Example app listening on port 3000!');
});

mkdir pubilc

cd public

cp swagger-ui/dist/* (当前文件夹public)

node …/index.js

报错:Error: Cannot find module 'express'

到当前项目目录下执行命令:

npm link express

修改index.html中的js代码的url路径/static/test.json

swagger学习:https://blog.csdn.net/xiang__liu/article/details/80396642
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值