Using next-routes with prefix
See original GitHub issueHi I have an issue like below:
server.js
app.prepare().then(() => {
const server = express();
const router = express.Router();
router.get('/:area', (req, res) => {
return app.render(req, res, '/index', req.query);
});
router.get('*', (req, res) => handle(wrappedRequest(req), res));
server.use('/prefix', router);
server.use('/prefix/static', express.static('static'));
server.listen(3000, err => {
if (err)
throw err;
console.log(`> Ready on http://localhost:3000/prefix`);
});
});
what I want to do is using next-routes? It worked fine when not using prefix
.
Is there any way to integrate prefix to next-route
?
Issue Analytics
- State:
- Created 6 years ago
- Comments:6 (1 by maintainers)
Top Results From Across the Web
next.js - Adding prefix to Nextjs dynamic route - Stack Overflow
This will make any link to /@username go to the /users/[username] file, even though the address bar will show /@username . Then, in...
Read more >Routing: Introduction - Next.js
Next.js has a built-in, opinionated, and file-system based Router. ... The router will automatically route files named index to the root of the...
Read more >next-routes-with-locale - npm
Easy to use locale-based dynamic routes for Next.js. ... Start using next-routes-with-locale in your project by running `npm i ...
Read more >next-routes-i18n - npm Package Health Analysis - Snyk
next-routes -i18n. v1.8.6. Internationalized routing alternative for Next.js For more information about how to use this package see README.
Read more >Route.Chain (jooby-project 1.6.6 API)
All the pending/next routes from pipeline. Method Detail. next. void next(@Nullable String prefix, Request req, ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
My solution is to modify the findAndGetUrls method. I am using the ENV var named basedPath. It works nicely
next.config.js
server.js
routes.js
I wanted to have all my routes prefixed with assetPrefix, but I didn’t manage to export it from the config file in a clean way.
My solution was to replicate
assetPrefix
in the public settings and overrideLink
with it:next.config.js
routes.js