logo

Contact us

Blogs

AutoCodeGen Code generation and Initial setup for banking

In the previous article, we logged in to AutoCodeGen's code generation platform and created our banking project, and input our table information.

In this article, we will generate the code in AutoCodeGen, download it, install the necessary node packages, test the CRUD operations of some of the tables, and initialize the values of necessary tables. With this, we can offer basic banking services to onboard the customers.

logo

Downloading the code:

In AutoCodeGen, from our project copy the project name and click on generate button, paste the project name when prompted, and click on generate button again. You will see an alert box that says code generation is successful, within seconds.

logo

AutoCodeGen has generated close to 2000 lines of code within seconds, saving loads of development time and resources.

Now click on download to download the project. Extract the downloaded code into a folder and open it in VSCode. Now open a terminal window where package.json is located, and do npm install, which will install all the necessary dependencies.

logo

We are using PostgreSQL DB for our project, if you do not have Pg admin, you can install it by clicking this link.

Setting DB password

Once done, input your password information in config/db.js as shown in the image. And then run node index.js from the terminal, our node.js app will start on port number 8080.

logo

Understanding the code base

Open index.js, we can see from line 15 to line 48, which are the base URL definitions for each of the tables we have defined. Navigate to one of the router file definitions we can see standard CRUD URLs for that particular table.

logo

Lets say that we need to add new customer type to our customer_types table then `you_domain_name/customer_types/post_customer_types_data` is the URL to use. And when making API calls using the URLs, correct request types should be used. To add new data use post, to update use patch, to get existing data in DB use get, and to delete a data use delete request type.

We are using thunder client, a Vscode extension to test our API calls. As we can see in the below image, we have created a separate collection for each of the tables and added all the available API endpoints to the respective collection.

logo

If you want to add new data to the database, open the controller file of the respective endpoint, look at what is defined in the object variable copy and pass it to the body of the request in thunder client.

Below we can see what is defined in the object of the controller and what is passed in the body of the request.

logologo

To get one inserted value or to update or delete a row in a table we need to pass the primary key of the table as a request query.

logo

We have added customer_types, account_types, transaction_types, products_and_services, and merchants' information to the respective tables. This initialization would be enough for us to onboard customers to the bank and let them make some transactions.

Account Types

logo

Customer Types

logo

Products and Services

logo

Merchants

logo

Transaction Types

logo

To understand how other CRUD operations work you can look into this article.

Following the above article, we have removed authentication for all our endpoints, we will discucss it in a separate article.

In the next article, we will onboard our customer, add a couple of products or services for the customer to use, and get our customer to execute some transactions.

Talk to us...

logo

© 2022 AutoCodeGen. All rights reserved

Company

About usOur BlogsContact Us