feat: printer next (#601)

* feat: add printer and next.js logger style

* chore: add info for API Proxy

* tests: unit test cases is added to printer

* fix: deps

Co-authored-by: DarkSky <25152247+darkskygit@users.noreply.github.com>
This commit is contained in:
Chi Zhang
2022-12-29 10:20:57 +08:00
committed by GitHub
parent 0b418e05b2
commit 4dfccf5c95
6 changed files with 92 additions and 5 deletions
+10 -3
View File
@@ -2,6 +2,7 @@
const { getGitVersion, getCommitHash } = require('./scripts/gitInfo');
const { dependencies } = require('./package.json');
const path = require('node:path');
const printer = require('./scripts/printer').printer;
/** @type {import('next').NextConfig} */
const nextConfig = {
@@ -32,18 +33,24 @@ const nextConfig = {
// XXX not test yet
rewrites: async () => {
if (process.env.NODE_API_SERVER === 'ac') {
console.log('use ac server');
let destinationAC = 'http://100.85.73.88:12001/api/:path*';
printer.info('API request proxy to [AC Server] ' + destinationAC);
return [
{
source: '/api/:path*',
destination: 'http://100.85.73.88:12001/api/:path*',
destination: destinationAC,
},
];
} else {
let destinationStandard = 'http://100.77.180.48:11001/api/:path*';
printer.info(
'API request proxy to [Standard Server] ' + destinationStandard
);
return [
{
source: '/api/:path*',
destination: 'http://100.77.180.48:11001/api/:path*',
destination: destinationStandard,
},
];
}