本文整理匯總了TypeScript中@feathersjs/express.json函數的典型用法代碼示例。如果您正苦於以下問題:TypeScript json函數的具體用法?TypeScript json怎麽用?TypeScript json使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。
在下文中一共展示了json函數的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。
示例1: before
before(() => {
const restApp = express.default(feathers())
.use(express.json())
.configure(express.rest())
.use(express.parseAuthentication('jwt'));
app = getApp(restApp as unknown as FeathersApplication) as express.Application;
app.use(express.errorHandler());
server = app.listen(9776);
});
示例2: createApp
export default async function createApp() {
log('Creating Feathers App');
await mongoose.connect(mongoUrl, { useNewUrlParser: true });
await setupSteam();
const app = express(feathers<ServerApp>());
app
.use(express.json())
.use(express.urlencoded({ extended: true }))
.use(cookie())
.hooks(hooks)
.configure(express.rest())
.configure(socketio({ path: '/ws/' }, (io) => {
io.on('connection', (socket: ServerSocket) => {
app.emit('socket-connection', socket);
});
}))
.configure(configureDebug)
.configure(services)
.configure(configureChannels);
app
.use(express.notFound({ verbose: true }))
.use(express.errorHandler({
html(error, _, res) {
res.send(render(error));
},
logger: false,
}));
log('Created Feathers App');
return app;
}
示例3: feathersExpress
import feathers, { Application } from '@feathersjs/feathers';
import feathersExpress, * as express from '@feathersjs/express';
const app = feathersExpress(feathers());
const feathersServiceDummy = {
get : () => {
return Promise.resolve({});
},
find : () => {
return Promise.resolve([{}, {}]);
}
};
const expressMiddlewareDummy = (req: express.Request, res: express.Response, next: express.NextFunction) => {
next();
return app;
};
app.use(express.json());
app.use(express.urlencoded({extended : true}));
app.use('/', express.static('./public'));
app.use('/', expressMiddlewareDummy, feathersServiceDummy);
app.configure(express.rest());
app.use(express.notFound());
app.use(express.errorHandler({logger : console}));