add remove method for aliases
This commit is contained in:
94
src/app.ts
94
src/app.ts
@@ -1,4 +1,4 @@
|
||||
import { feathers } from '@feathersjs/feathers'
|
||||
import { feathers } from "@feathersjs/feathers";
|
||||
import express, {
|
||||
rest,
|
||||
json,
|
||||
@@ -6,80 +6,84 @@ import express, {
|
||||
cors,
|
||||
serveStatic,
|
||||
notFound,
|
||||
errorHandler
|
||||
} from '@feathersjs/express'
|
||||
import configuration from '@feathersjs/configuration'
|
||||
import socketio from '@feathersjs/socketio'
|
||||
import session from 'express-session';
|
||||
import cookieParser from 'cookie-parser';
|
||||
errorHandler,
|
||||
} from "@feathersjs/express";
|
||||
import configuration from "@feathersjs/configuration";
|
||||
import socketio from "@feathersjs/socketio";
|
||||
import session from "express-session";
|
||||
import cookieParser from "cookie-parser";
|
||||
|
||||
import type { Application } from './declarations'
|
||||
import type { Application } from "./declarations";
|
||||
|
||||
import { logger } from './logger'
|
||||
import { logError } from './hooks/log-error'
|
||||
import { services } from './services/index'
|
||||
import { channels } from './channels'
|
||||
import { randomUUID } from 'crypto';
|
||||
import { logger } from "./logger";
|
||||
import { logError } from "./hooks/log-error";
|
||||
import { services } from "./services/index";
|
||||
import { channels } from "./channels";
|
||||
import { randomUUID } from "crypto";
|
||||
|
||||
const app: Application = express(feathers())
|
||||
const app: Application = express(feathers());
|
||||
|
||||
// Load app configuration
|
||||
app.configure(configuration())
|
||||
app.use(cors())
|
||||
app.use(json({
|
||||
limit: '20mb'
|
||||
}))
|
||||
app.configure(configuration());
|
||||
app.use(cors());
|
||||
app.use(
|
||||
json({
|
||||
limit: "20mb",
|
||||
}),
|
||||
);
|
||||
|
||||
app.use(cookieParser());
|
||||
app.use(session({
|
||||
secret: randomUUID(),
|
||||
resave: false,
|
||||
saveUninitialized: true,
|
||||
cookie: { secure: false }
|
||||
}));
|
||||
app.use(
|
||||
session({
|
||||
secret: randomUUID(),
|
||||
resave: false,
|
||||
saveUninitialized: true,
|
||||
cookie: { secure: false },
|
||||
}),
|
||||
);
|
||||
|
||||
// Propagate session to request.params in feathers services
|
||||
app.use(function (req, _res, next) {
|
||||
req.feathers = {
|
||||
...req.feathers,
|
||||
session: req.session
|
||||
}
|
||||
next()
|
||||
session: req.session,
|
||||
};
|
||||
next();
|
||||
});
|
||||
|
||||
app.use(urlencoded({ extended: true }))
|
||||
app.use(urlencoded({ extended: true }));
|
||||
// Host the public folder
|
||||
app.use('/', serveStatic(app.get('public')))
|
||||
app.use("/", serveStatic(app.get("public")));
|
||||
|
||||
// Configure services and real-time functionality
|
||||
app.configure(rest())
|
||||
app.configure(rest());
|
||||
app.configure(
|
||||
socketio({
|
||||
cors: {
|
||||
origin: app.get('origins')
|
||||
}
|
||||
})
|
||||
)
|
||||
app.configure(services)
|
||||
app.configure(channels)
|
||||
origin: app.get("origins"),
|
||||
},
|
||||
}),
|
||||
);
|
||||
app.configure(services);
|
||||
app.configure(channels);
|
||||
|
||||
// Configure a middleware for 404s and the error handler
|
||||
app.use(notFound())
|
||||
app.use(errorHandler({ logger }))
|
||||
app.use(notFound());
|
||||
app.use(errorHandler({ logger }));
|
||||
|
||||
// Register hooks that run on all service methods
|
||||
app.hooks({
|
||||
around: {
|
||||
all: [logError]
|
||||
all: [logError],
|
||||
},
|
||||
before: {},
|
||||
after: {},
|
||||
error: {}
|
||||
})
|
||||
error: {},
|
||||
});
|
||||
// Register application setup and teardown hooks here
|
||||
app.hooks({
|
||||
setup: [],
|
||||
teardown: []
|
||||
})
|
||||
teardown: [],
|
||||
});
|
||||
|
||||
export { app }
|
||||
export { app };
|
||||
|
Reference in New Issue
Block a user