This commit is contained in:
Florian Bouillon 2023-06-14 02:46:14 +02:00
parent 70d52c096d
commit e41e81d162
3 changed files with 7 additions and 61 deletions

View File

@ -4,7 +4,7 @@ import node from "@astrojs/node";
// https://astro.build/config // https://astro.build/config
export default defineConfig({ export default defineConfig({
// site: 'https://www.nasap3d.com', site: 'https://print.dzeio.com',
integrations: [tailwind()], integrations: [tailwind()],
build: { build: {
assets: 'assets' assets: 'assets'

View File

@ -1,54 +0,0 @@
import { Response } from 'express'
/**
* An error as of the RFC7807
*
* you MUST send the content-type `application/problem+json`
*/
export default interface HTTPError extends Record<string, any> {
/**
* A URI reference [RFC3986] that identifies the
* problem type. This specification encourages that, when
* dereferenced, it provide human-readable documentation for the
* problem type (e.g., using HTML [W3C.REC-html5-20141028]). When
* this member is not present, its value is assumed to be
* "about:blank".
*/
title: string
/**
* A short, human-readable summary of the problem
* type. It SHOULD NOT change from occurrence to occurrence of the
* problem, except for purposes of localization (e.g., using
* proactive content negotiation; see [RFC7231], Section 3.4).
*/
type?: string
/**
* The HTTP status code ([RFC7231], Section 6)
* generated by the origin server for this occurrence of the problem.
*/
status?: number
/**
* A human-readable explanation specific to this
* occurrence of the problem.
*/
detail?: string
/**
* A URI reference that identifies the specific
* occurrence of the problem. It may or may not yield further
* information if dereferenced.
*/
instance?: string
}
export function createErrorResponse(res: Response, error: HTTPError) {
res.status(error.status ?? 500)
if (!error.type) {
error.type = 'about:blank'
}
res.setHeader('Content-Type', 'application/problem+json')
res.json(error)
}

View File

@ -1,9 +1,9 @@
import { objectMap, objectOmit } from '@dzeio/object-util' import { objectMap, objectOmit } from '@dzeio/object-util'
import URLManager from '@dzeio/url-manager' import URLManager from '@dzeio/url-manager'
import type { APIRoute } from 'astro' import type { APIRoute } from 'astro'
import { exec as execSync } from 'child_process'
import fs from 'fs/promises'
import { evaluate } from 'mathjs' import { evaluate } from 'mathjs'
import { exec as execSync } from 'node:child_process'
import fs from 'node:fs/promises'
import os from 'node:os' import os from 'node:os'
import path from 'node:path/posix' import path from 'node:path/posix'
import { promisify } from 'node:util' import { promisify } from 'node:util'