Skip to content

bronifty/serverless-mern-stack-vite

Repository files navigation

Serverless-MERN-Stack

AWS

  • in /src/hooks/tasks:
  • uncomment const baseURL = '/api/v1/tasks/';
  • comment const baseURL = '/.netlify/functions/index/api/v1/tasks/';
  • requires serverless cli and serverless-offline npm packages
yarn build
sls offline start

Vercel

  • Note: Vercel cli may not work for linking this vite project (with 'vercel link'); you may need to put the code in source control and connect it to your Vercel account manually.
  • in /src/hooks/tasks:
  • uncomment const baseURL = '/api/v1/tasks/';
  • comment const baseURL = '/.netlify/functions/index/api/v1/tasks/';
  • requires vercel cli npm package
vercel dev

Netlify

  • in /src/hooks/tasks:
  • comment const baseURL = '/api/v1/tasks/';
  • uncomment const baseURL = '/.netlify/functions/index/api/v1/tasks/';
ntl dev

-Note:

  • aws and vercel are running on the /api/v1/tasks endpoint; netlify is running on /.netlify/functions/index/api/v1/tasks/ to run locally:
  • vercel or aws:
    • uncomment const baseURL = '/api/v1/tasks/';
    • comment const baseURL = '/.netlify/functions/index/api/v1/tasks/';
  • netlify:
    • uncomment const baseURL = '/.netlify/functions/index/api/v1/tasks/';
    • comment const baseURL = '/api/v1/tasks/';