Main B3 API
npm install @b3dotfun/b3-api> Main B3 API
This project uses Feathers. An open source framework for building APIs and real-time applications.
1. Make sure you have NodeJS and npm installed.
2. Install your dependencies
```
cd path/to/b3-api
npm install
3. Start your app
``
npm run build # Compile TypeScript source
npm start
Run npm test and all your tests in the test/ directory will be run.
This project includes an auto-generated Postman collection for all API endpoints:
`bash`Generate/update the Postman collection
pnpm run generate:postman
This creates b3-api.postman_collection.json with all service endpoints organized by route.
Quick Start:
1. Run pnpm run generate:postmanb3-api.postman_collection.json
2. Import into Postmanjwt_token
3. Set variable (copy b3-auth cookie from global.b3.fun)
4. Start testing!
š See README_POSTMAN.md for detailed documentation.
This app comes with a powerful command line interface for Feathers. Here are a few things it can do:
``
$ npx feathers help # Show all commands
$ npx feathers generate service # Generate a new Service
Use the Feathers CLI via pnpm:
``
pnpm dlx @feathersjs/cli generate service
This project uses a custom MongoDBExtendedService that extends the standard Feathers MongoDB service with additional type safety and functionality.
When working with MongoDB collections in service methods, always use await this.db() instead of await this.getModel(params) for better type safety:
`typescript
// ā
Recommended - Provides full type safety
const collection = await this.db();
// ā Avoid - Generic collection without proper typing
const collection = await this.getModel(params);
`
The db() method returns a properly typed Collection
- Better TypeScript autocomplete and IntelliSense
- Compile-time type checking for document fields
- Enhanced refactoring support
- Prevention of runtime errors from typos
For more information on all the things you can do with Feathers visit docs.feathersjs.com.