SpectraSync Eye Glass is a Backend Application with robust data management system, facilitating user, order, and address organization. Powered by MongoDB, it ensures secure data storage and smooth operation, making it an essential tool for efficient application data handling.
Live Project Link: https://spectrasync-glasses.netlify.app/
Server site Link: https://spectrasync-server.vercel.app/
Before you begin, make sure you have the following installed on your machine:
- Node.js: Download and Install Node.js
- TypeScript: Install TypeScript globally using the following command:
npm install -g typescript git clone https://github.com/Porgramming-Hero-web-course/l2b2-full-stack-a5-server-side-isratjmn cd spectrasync-server
npm installCreate a .env file in the root of the project and add any necessary environment variables. You can use the provided .env.example file as a template.
bash
PORT=5000
NODE_ENV=development
DATABASE_URL=mongodb+srv://spectraUser:mnmn318600@cluster0.ocimcqo.mongodb.net/spectraDB?retryWrites=true&w=majority
JWT_ACCESS_SECRET=b8f3bc5620ddf98594b408877e5e4952774a20906f9d381a75ba7fb2598cf9af
JWT_ACCESS_EXPIRES_IN=1d
BCRYPT_SALT_ROUNDS=10
CLOUDINARY_CLOUD_NAME=dmr810p4l
CLOUDINARY_API_KEY=847319449751949
CLOUDINARY_API_SECRET=8XGZjxc8BtcWI8XZ1wwCVvg-x_0
To run the application in development mode with automatic transpilation and server restart:
npm run start:devThis command uses ts-node-dev to watch for changes in the src directory, transpile TypeScript files, and restart the server.
To build the project for production:
npm run buildThis command uses the TypeScript compiler tsc to transpile the TypeScript code into JavaScript. The compiled code is output to the dist directory.
To start the application in production mode:
npm run start:dev npm install eslint @typescript-eslint/parser @typescript-eslint/eslint-plugin --save-devnpx eslint --initTo lint the code using ESLint:
npm run lintTo automatically fix linting issues:
npm run lint:fixnpm install --save-dev prettier{
"semi": false,
"singleQuote": true,
}
npx prettier --write src/index.tsTo format the code using Prettier:
npm run prettierTo automatically fix formatting issues:
npm run prettier:fix