Code Monkey home page Code Monkey logo

node-metaweblog-api-adaptor's Introduction

This is a Next.js project bootstrapped with create-next-app.

Endpoint

/api/middleware

curl --location 'http://localhost:3000/api/middleware/fetch' \
--header 'Content-Type: application/json' \
--data '{
    "fetchParams": {
        "apiUrl": "http://127.0.0.1:6806/api/system/version",
        "fetchOptions": {
            "method": "POST"
        }
    }
}'
{
    "headers": {
        "status": 200,
        "statusText": "OK"
    },
    "body": {
        "code": 0,
        "msg": "",
        "data": "2.10.14"
    }
}

/api/translate?q=测试

/api/jieba?q=这是测试文字

最近更新

2024-03-13

1、fetch 代理新增 xml-body 支持

2024-03-01

1、返回结果支持 cookie。后续所有 cors 对应的 header 统一放在 body 的 "cors-received-headers" 字段

2、支持 cookie 解析

3、升级 next.js 到 v14

2023-11-12

1、jieba 更换为 node-rs

2、docker 更换为国内镜像。

3、新增调用 curl 调用实例

2023-08-14

1、新增image代理

2023-01-11

1、新增xmlrpc代理

2、新增fetch代理

2022-07-27

1、新增中文分词服务

2022-07-24

1、新增Google翻译服务

Getting Started

environment:

node = 16.20.2

First, run the development server:

npm run dev
# or
yarn dev

Open http://localhost:3000 with your browser to see the result.

You can start editing the page by modifying pages/index.tsx. The page auto-updates as you edit the file.

API routes can be accessed on http://localhost:3000/api/hello. This endpoint can be edited in pages/api/hello.ts.

The pages/api directory is mapped to /api/*. Files in this directory are treated as API routes instead of React pages.

This project uses next/font to automatically optimize and load Inter, a custom Google Font.

Docker

docker

docker run -itd --name=metaweblog-api -p 6333:3000 -e TZ=Asia/Shanghai --restart=unless-stopped nn200433/metaweblog-api:latest

docker-compose

version: '3'
services:
  metaweblog-api:
    image: nn200433/metaweblog-api:latest
    container_name: metaweblog-api
    restart: unless-stopped
    ports:
      - 6333:3000
    environment: 
      - TZ=Asia/Shanghai

Nginx

Installation

The nginx docker installation can be done using:

  1. nginxWebUI
  2. Nginx Proxy Manager

Configuration

server {
    # modify
    server_name <your domain>;
    
    listen 443 ssl http2;
    
    # modify
    ssl_certificate <your ssl pem file path>;
    ssl_certificate_key <your ssl key file path>;
    
    ssl_protocols TLSv1 TLSv1.1 TLSv1.2 TLSv1.3;
    listen 80;
    if ($scheme = http) {
      return 301 https://$host:443$request_uri;
    }

    underscores_in_headers on;

    # blog
    location / {
      proxy_pass http://127.0.0.1:8080;
      proxy_set_header Host $host;
      proxy_set_header X-Real-IP $remote_addr;
      proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
      proxy_set_header X-Forwarded-Host $http_host;
      proxy_set_header X-Forwarded-Port $server_port;
      proxy_set_header X-Forwarded-Proto $scheme;
      proxy_redirect http:// https://;
    }

    # metaweblog-api
    location /api {
      proxy_pass http://127.0.0.1:6333;
      proxy_set_header Host $host;
      proxy_set_header X-Real-IP $remote_addr;
      proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
      proxy_set_header X-Forwarded-Host $http_host;
      proxy_set_header X-Forwarded-Port $server_port;
      proxy_set_header X-Forwarded-Proto $scheme;
      proxy_redirect http:// https://;
    }
}

Learn More

To learn more about Next.js, take a look at the following resources:

You can check out the Next.js GitHub repository - your feedback and contributions are welcome!

Deploy on Vercel

The easiest way to deploy your Next.js app is to use the Vercel Platform from the creators of Next.js.

Check out our Next.js deployment documentation for more details.

node-metaweblog-api-adaptor's People

Contributors

nn200433 avatar terwer avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

nn200433

node-metaweblog-api-adaptor's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.