Skip to content

Commit

Permalink
(update): replace require with import & update libs to latest versions (
Browse files Browse the repository at this point in the history
  • Loading branch information
matewilk authored Mar 16, 2023
1 parent edf0f5c commit 9a447df
Show file tree
Hide file tree
Showing 10 changed files with 1,538 additions and 931 deletions.
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

0 comments on commit 9a447df

Please sign in to comment.