image image

Start

Installing packages

    # with npm
    $ npm install
    $ cd backend
    $ npm install

    # or with yarn
    $ yarn
    $ cd backend
    $ yarn

Create .env.local for root and create .env for /backend then fill by reference from example files

.env
ENV=development
PORT=3000
MONGO_URI=
ACCESS_TOKEN_SECRET=
REFRESH_TOKEN_SECRET=

For secret keys run that for twice

  $ node
  $ require('crypto').randomBytes(64).toString('hex')

Don't forget if you gonna change this VITE_BASE_URL firstly change the PORT variable from .env

.env.local
VITE_BASE_URL=http://localhost:3000

Config

If your frontend don't run automatically at this port http://localhost:5173/ go /backend/src/config/allowedOrigins.js and add yours

const allowedOrigins = [
  "http://localhost:5173",
  "https://astopia-test-case-frontend.vercel.app",
];

Technologies Used