[WIP] API routes working for Next.js

Things seemed to mostly work at first glance! I haven't tested outfitPageSSR because we'll need to redo it though, and also the outfit image routes aren't working anymore (vercel.json isn't how next.js works)
This commit is contained in:
Emi Matchu 2021-11-01 22:25:43 -07:00
parent 589c48beda
commit 8dab442929
8 changed files with 13 additions and 13 deletions

View file

@ -10,7 +10,7 @@ const beeline = require("honeycomb-beeline")({
import fetch from "node-fetch";
import connectToDb from "../src/server/db";
import connectToDb from "../../src/server/db";
async function handle(req, res) {
const allNcItemNamesAndIdsPromise = loadAllNcItemNamesAndIds();

View file

@ -9,8 +9,8 @@ const beeline = require("honeycomb-beeline")({
samplerHook,
});
const { ApolloServer } = require("../src/server/lib/apollo-server-vercel");
const { config } = require("../src/server");
const { ApolloServer } = require("../../src/server/lib/apollo-server-vercel");
const { config } = require("../../src/server");
const crypto = require("crypto");
const server = new ApolloServer(config);

View file

@ -39,12 +39,12 @@ import fetch from "node-fetch";
import gql from "graphql-tag";
import { print as graphqlPrint } from "graphql/language/printer";
import connectToDb from "../src/server/db";
import { renderOutfitImage } from "../src/server/outfit-images";
import connectToDb from "../../src/server/db";
import { renderOutfitImage } from "../../src/server/outfit-images";
import getVisibleLayers, {
petAppearanceFragmentForGetVisibleLayers,
itemAppearanceFragmentForGetVisibleLayers,
} from "../src/shared/getVisibleLayers";
} from "../../src/shared/getVisibleLayers";
const VALID_LAYER_URLS = [
/^https:\/\/(impress-asset-images\.openneo\.net|impress-asset-images\.s3\.amazonaws\.com)\/(biology|object)\/[0-9]{3}\/[0-9]{3}\/[0-9]{3}\/[0-9]+\/(150|300|600)x(150|300|600)\.png(\?[a-zA-Z0-9_-]+)?$/,

View file

@ -25,8 +25,8 @@ const beeline = require("honeycomb-beeline")({
import escapeHtml from "escape-html";
import fetch from "node-fetch";
import connectToDb from "../src/server/db";
import { normalizeRow } from "../src/server/util";
import connectToDb from "../../src/server/db";
import { normalizeRow } from "../../src/server/util";
async function handle(req, res) {
// Load index.html as our initial page content. If this fails, it probably

View file

@ -10,13 +10,13 @@ const beeline = require("honeycomb-beeline")({
const AWS = require("aws-sdk");
const Jimp = require("jimp");
const connectToDb = require("../src/server/db");
const buildLoaders = require("../src/server/loaders");
const connectToDb = require("../../src/server/db");
const buildLoaders = require("../../src/server/loaders");
const {
loadBodyName,
logToDiscord,
normalizeRow,
} = require("../src/server/util");
} = require("../../src/server/util");
if (
!process.env["DTI_AWS_ACCESS_KEY_ID"] ||

View file

@ -7,8 +7,8 @@ const beeline = require("honeycomb-beeline")({
serviceName: "impress-2020-gql-server",
disableInstrumentationOnLoad: true,
});
import connectToDb from "../src/server/db";
import { getPoseFromPetState, normalizeRow } from "../src/server/util";
import connectToDb from "../../src/server/db";
import { getPoseFromPetState, normalizeRow } from "../../src/server/util";
export async function getValidPetPoses() {
const db = await connectToDb();