Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use as a module or middleware in separated existing express server #43

Open
EdgarJeremy opened this issue Jul 26, 2018 · 0 comments
Open

Comments

@EdgarJeremy
Copy link

EdgarJeremy commented Jul 26, 2018

I don't want my server to be inside of the instance of Tilesplash. In other words, I just want to use the .layer() method and the render() function attached to a completely separated express server.
Say that I have a server configuration like this :

const express = require('express');
const app = express();
app.use('/api', require('./routes/api'));
// ... (a lot of middleware config & routes) ...
app.listen(8080);

It'll be much more convenient if this library can act as a middleware so I can easily access the tile object and the render function attached to the res object like this

app.use(tilesplash({..options}));
app.get('/tile/:x/:y/:z', (req, res)=>{
  // res.render() <-- the render() function
  // res.tile <-- the tile object
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant