Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

(update): replace require with import & update libs to latest versions #15

Merged
merged 2 commits into from
Mar 16, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 0 additions & 4 deletions .babelrc

This file was deleted.

2 changes: 1 addition & 1 deletion components/Logger.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const winston = require("winston");
import winston from "winston";

/* Example logger with custom formatter
https://github.com/winstonjs/winston#combining-formats
Expand Down
45 changes: 22 additions & 23 deletions middleware.js
Original file line number Diff line number Diff line change
@@ -1,31 +1,30 @@
'use strict'
const { NextResponse } = require('next/server')
"use strict";
import { NextResponse } from "next/server";

module.exports.middleware = async function middleware(request) {
if (request.nextUrl.pathname === '/') {
if (request.nextUrl.pathname === "/") {
// This logic is only applied to /about
const response = NextResponse.next()
await new Promise((resolve) => {
setTimeout(resolve, 25)
})
response.headers.set('x-custom', 'another-header')
return response
const response = NextResponse.next();
await new Promise((resolve) => {
setTimeout(resolve, 25);
});
response.headers.set("x-custom", "another-header");
return response;
}

if (request.nextUrl.pathname === '/api') {
const response = NextResponse.next()
await new Promise((resolve) => {
setTimeout(resolve, 10)
})
return response
if (request.nextUrl.pathname === "/api") {
const response = NextResponse.next();
await new Promise((resolve) => {
setTimeout(resolve, 10);
});
return response;
}

if (request.nextUrl.pathname.startsWith('/blog')) {
const response = NextResponse.next()
await new Promise((resolve) => {
setTimeout(resolve, 10)
})
return response
if (request.nextUrl.pathname.startsWith("/blog")) {
const response = NextResponse.next();
await new Promise((resolve) => {
setTimeout(resolve, 10);
});
return response;
}
}

};
Loading