Welcome to my backend test project
View Project Documentation on Postman
- Express.js: A fast, minimalist web framework for Node.js.
- TypeScript: A superset of JavaScript that adds static types and improved tooling.
- ESLint: Enforce code quality and consistent formatting.
- Mocha and Chai: A powerful testing framework.
- dotenv: Load environment variables from a
.env
file. - Docker: Containerization for easy deployment.
-
Clone this repository:
git clone https://github.com/Abuka-Victor/backend-test.git cd backend-test
-
Install dependencies:
npm install
-
Create a
.env
file in the root directory and add necessary environment variables:POSTGRES_URI=your_postgres_uri APP_SECRET=your_app_secret PORT=8080_was_what_I_used_in_development ACCESS_TOKEN_PRIVATE_KEY=your_access_token_secret REFRESH_TOKEN_PRIVATE_KEY=your_refresh_token_secret NODE_ENV=development_or_production REDIS_URI=your_redis_uri
-
Start the development server:
npm start
-
Open your postman and navigate to
http://localhost:PORT
to access the app and test the routes. -
Navigate to
http://localhost:PORT/docs
to access the swagger docs UI.
src/
: Contains the TypeScript source code.app.ts
: Entry point for the Express application.routes/
: Define your API routes here.controllers/
: Handle route logic.middleware/
: Custom middleware functions.test/
: Contains test filesconfig/
: Configuration files and environment variable management.models/
: Contains model classes.utils/
: A folder for helper functions and my swagger setupvalidators/
: A folder for api body validators.
dist/
: Compiled TypeScript code (generated after build).
- Run tests using Mocha and Chai:
npm test
-
Build the project:
npm run build
-
Run the production server:
npm start
-
Build the Docker image:
docker build -t backend-test .
-
Run the Docker container:
docker run -p 3000:8080 backend-test
For inquiries, contact Your Email.