
Security News
/Research
Coordinated npm and PyPI Campaign Typosquats Popular Secure Payment Apps
Socket uncovered 17 malicious npm and PyPI packages typosquatting Paysafe, Skrill, and Neteller SDKs to steal developer secrets.
@xlera/conv-rest-api
Advanced tools
This project is under development and will soon be integrated into the Convector CLI.
This project aims to provide an easy way for generating automatically client API for Convector projects.
To generate an API, you first need a Convector CLI generated project. Since the conv-rest-api is based on the Convector CLI standards and conventions, so manually projects generated may not work with it.
In the root of your project create a json file called api.json. This structure will map the smart contract to the Express API.
[
{
"function": "<function-name>",
"controller": "<controller-class-name>",
"verb": "get|post|put|delete"
},
{
...
}
]
If your smart contract project has the following structure:
./packages/participants/src/participant.controller.ts./packages/person/src/person.controller.tsAnd the controller files look like this:
@Controller('participant')
export class ParticipantController extends ConvectorController {
get fullIdentity(): ClientIdentity {
const stub = (BaseStorage.current as any).stubHelper;
return new ClientIdentity(stub.getStub());
};
@Invokable()
public async register(
@Param(yup.string())
id: string,
@Param(yup.string())
name: string,
) {
//...
}
}
@Controller('person')
export class PersonController extends ConvectorController<ChaincodeTx> {
@GetAll('Person')
@Invokable()
public async getone(
@Param(Person)
id: string) {
// ...
}
@Create('Person')
@Invokable()
public async create(
@Param(Person)
person: Person
) {
// ...
}
}
Then your api.json
[
{
"function": "register",
"controller": "ParticipantController"
},
{
"function": "create",
"verb": "post",
"controller": "PersonController"
},
{
"function": "getone",
"verb": "get",
"controller": "PersonController"
}
]
Once that's ready, globally install the conv-rest-api util and generate your API!
Beware that it will remove and recreate a folder in your root
./packages/folder calledserver.
npm i -g @worldsibu/conv-rest-api
# Inside your Convector CLI generated project's root
conv-rest-api generate api -c <chaincode-project-name> -f ./<chaincode-config-file>
# I.e.: conv-rest-api generate api -c person -f ./org1.person.config.json
# Compile everything
[npx] lerna bootstrap
# Start the server
[npx] lerna run start --scope server --stream
Special thanks to Luca Tamburrano for starting this amazingly useful project for the community.
FAQs
Rest API generator for the Convector Framework
The npm package @xlera/conv-rest-api receives a total of 0 weekly downloads. As such, @xlera/conv-rest-api popularity was classified as not popular.
We found that @xlera/conv-rest-api demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 2 open source maintainers collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
/Research
Socket uncovered 17 malicious npm and PyPI packages typosquatting Paysafe, Skrill, and Neteller SDKs to steal developer secrets.

Security News
Node.js is debating whether AI-driven security report volume warrants moving more vulnerability reports into public workflows.

Security News
PolinRider expands across npm, Packagist, Go modules, and Chrome extensions, using hidden loaders to target developer environments.