Comments (4)
Thank you @rylnd for looking into this. I'll look into it further and may end up making that contribution.
from avatars-api-middleware.
Hi @gianlazz ! Apologies in advance as I'm not very familiar with NestJS.
While I wasn't able to find any official examples of using an express middleware in NestJs in their documentation it appears as though they're expecting an object with a use
method, rather than the anonymous function that defines our middleware (and your error does seem to point to that expectation).
I also found this post that seems to indicate that the avatars middleware might not currently be compatible (we do not currently export individual handler functions, just the full router instance). If such a refactoring is necessary, that would be a great contribution! 😉
I hope that sets you on the right path; let me know if I can help further!
from avatars-api-middleware.
try something like this in your controller
configure(consumer: MiddlewareConsumer) {
consumer
.apply(avatarsMiddleware)
.forRoutes('/avatars');
}
from avatars-api-middleware.
I was able to resolve the issue with the following:
import { NestFactory } from '@nestjs/core';
import { ExpressAdapter } from '@nestjs/platform-express';
import { AppModule } from './app.module';
import express = require('express');
async function bootstrap() {
const instance = express();
instance.use('/avatars', require('adorable-avatars/dist/index'));
const app = await NestFactory.create(AppModule, new ExpressAdapter(instance));
await app.listen(process.env.PORT || 8080);
}
bootstrap();
from avatars-api-middleware.
Related Issues (20)
- Identifier can result in a 404 HOT 2
- Library can't be installed HOT 5
- Difference between generated and result of link on the website HOT 1
- API Site is gone? HOT 17
- I got an error when visiting adorable.io/.
- Make the repository name more descriptive. HOT 3
- Let's work together HOT 8
- Discussion: a better routing schema HOT 8
- Size parameter in URL does not work HOT 3
- CORS from github? HOT 3
- URL's not working all of a sudden, service seems to be down. HOT 3
- Discussion : Laravel Installation or Use HOT 1
- Empty response from server HOT 8
- module.exports missing HOT 5
- Can I use in mobile application? HOT 2
- Remove outdated/confusing server code
- Replace babel-watch due to slow security fixes HOT 1
- Replace imagemagick HOT 1
- extensions affect the returned avatar HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from avatars-api-middleware.