Deploying Next API to a subdomain
Unanswered
jgoon posted this in #help-forum
jgoonOP
Instead of deploying to
domain.com/api is it possible to deploy it to api.domain.com?10 Replies
@jgoon Instead of deploying to `domain.com/api` is it possible to deploy it to `api.domain.com`?
Broad-snouted Caiman
Domain doesnt matter i guess
Beacuse its always /api/test.js
No matter domain
@Broad-snouted Caiman No matter domain
jgoonOP
so you simply can't change the domain
@jgoon so you simply can't change the domain
Broad-snouted Caiman
Nextjs always gave /api in it
You can use express js if u want api.something.com
jgoonOP
yeah im currently switching from express to next bc serverless makes more sense, currently deployed on api.domain.com and wanted to see if i count keep that not a big issue tho
@jgoon yeah im currently switching from express to next bc serverless makes more sense, currently deployed on api.domain.com and wanted to see if i count keep that not a big issue tho
if you use app router, you can absolutely remove /api
@Broad-snouted Caiman Nextjs always gave /api in it
this is incorrect for app dir
@jgoon Instead of deploying to `domain.com/api` is it possible to deploy it to `api.domain.com`?
if you use the app router, you dont need the
if you use the pages router, you need the
/api partif you use the pages router, you need the
/api part, but you can always deploy it to, say, jgoon.domain.com/api and then make another app at api.domain.com that rewrites to this jgoon.domain.com/api.