Yousef
10/22/2021, 2:59 PMarda
10/22/2021, 3:04 PMnpm run dev from your frontend directory, you should be able to see your site at <http://localhost:3000/>Yousef
10/22/2021, 3:06 PMarda
10/22/2021, 3:10 PMnpx sst deploy then the provided CF endpoint would have your latest changearda
10/22/2021, 3:11 PMnpx sst start is to set up a local live development while sst deploy would actually do a prod-like deployment onto awsYousef
10/22/2021, 3:13 PMarda
10/22/2021, 3:15 PM<http://localhost:3000/api/><apiPath> return your result?thdxr
10/22/2021, 3:30 PMsst start I believe we deploy your api routes as edge functions. These aren't sst.Functions so they cannot be live debuggedthdxr
10/22/2021, 3:30 PMthdxr
10/22/2021, 3:31 PMthdxr
10/22/2021, 3:31 PM/api/* should go to the deployed functionYousef
10/22/2021, 3:36 PMthdxr
10/22/2021, 3:39 PMFrank
Frank
/posts/api?Frank
sst deploy, Next.js builds and bundles these api routes along with getServerSideProps, getStaticProps incremental regeneration, etc, and are deployed to Lambda@Edge functions along with the CloudFront distribution.
On sst start, a stub Next.js app is deployed, so your api routes are not deployed.Frank
sst start, the only way to invoke the Next.js api routes are to also start up Next.js (ie. npm run dev), and hits <http://localhost:3000/api/><apiPath> like @arda suggested.Frank
npm run dev directly - https://nextjs.org/docs/advanced-features/debuggingFrank
Yousef
10/22/2021, 10:35 PM