mirror of https://github.com/iconify/api.git
chore: update all dependencies, update routes for latest fastify
This commit is contained in:
parent
f79638ef5f
commit
8e35844326
File diff suppressed because it is too large
Load Diff
12
package.json
12
package.json
|
|
@ -11,7 +11,7 @@
|
|||
"type": "git",
|
||||
"url": "https://github.com/iconify/api.git"
|
||||
},
|
||||
"packageManager": "npm@11.6.2",
|
||||
"packageManager": "npm@11.6.4",
|
||||
"engines": {
|
||||
"node": ">=22.20.0"
|
||||
},
|
||||
|
|
@ -26,17 +26,17 @@
|
|||
"docker:publish": "docker push iconify/api"
|
||||
},
|
||||
"dependencies": {
|
||||
"@fastify/formbody": "^7.4.0",
|
||||
"@iconify/tools": "^4.1.4",
|
||||
"@fastify/formbody": "^8.0.2",
|
||||
"@iconify/tools": "^5.0.0-beta.5",
|
||||
"@iconify/types": "^2.0.0",
|
||||
"@iconify/utils": "^2.3.0",
|
||||
"@iconify/utils": "^3.1.0",
|
||||
"dotenv": "^17.2.3",
|
||||
"fastify": "^4.29.1"
|
||||
"fastify": "^5.6.2"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/jest": "^30.0.0",
|
||||
"@types/node": "^24.10.1",
|
||||
"typescript": "^5.9.3",
|
||||
"vitest": "^4.0.10"
|
||||
"vitest": "^4.0.14"
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -23,7 +23,9 @@ import { errorText } from './helpers/errors.js';
|
|||
export async function startHTTPServer() {
|
||||
// Create HTP server
|
||||
const server = fastify({
|
||||
caseSensitive: true,
|
||||
routerOptions: {
|
||||
caseSensitive: true,
|
||||
},
|
||||
});
|
||||
|
||||
// Support `application/x-www-form-urlencoded`
|
||||
|
|
@ -199,21 +201,21 @@ export async function startHTTPServer() {
|
|||
|
||||
// Redirect
|
||||
server.get('/', (req, res) => {
|
||||
res.redirect(301, appConfig.redirectIndex);
|
||||
res.redirect(appConfig.redirectIndex, 301);
|
||||
});
|
||||
|
||||
// Error handling
|
||||
server.setDefaultRoute((req, res) => {
|
||||
server.setNotFoundHandler((req, res) => {
|
||||
res.statusCode = 404;
|
||||
console.log('404:', req.url);
|
||||
|
||||
// Need to set custom headers because hooks don't work here
|
||||
for (let i = 0; i < headers.length; i++) {
|
||||
const header = headers[i];
|
||||
res.setHeader(header.key, header.value);
|
||||
res.header(header.key, header.value);
|
||||
}
|
||||
|
||||
res.end();
|
||||
res.send();
|
||||
});
|
||||
|
||||
// Start it
|
||||
|
|
|
|||
Loading…
Reference in New Issue