frameworks
Handle Creation of Single or Multiple Records in AdonisJS
· ☕ 2 min read
Support creation of a single record or a group of records using same business logic and in the same controller in AdonisJS. Typically you create the following controller to handle record creation - 1 2 3 4 5 6 // TodoController.js async create({ request, auth }) { const data = request.

Custom Configuration Parameters in AdonisJS
· ☕ 1 min read
AdonisJS stores its configuration values in config folder in root. For e.g. you will set database environment values in database.js, authentication params in auth.js and so on. You can update or set new configuration parameters required by your application in those files. You could also create a new configuration file for your application variables and refer to those values from services, controllers, or from any place where it makes sense.

Pagination in AdonisJS
· ☕ 3 min read
AdonisJS provides a standard way to handle pagination and query only a pre-defined number of records in your query result. A typical controller without any pagination looks like the below - 1 2 3 4 5 6 7 8 // TodoController.js const Todo = use("App/Models/Todo"); class TodoController { async index({ request, response, view }) { return await Todo.

Role-based Access to Routes in AdonisJS
· ☕ 2 min read
AdonisJS provides a standard way to define a middleware and enable access to routes based on defined validation rules. This middleware is leveraged to allow role-based access to routes. Your start | routes.js file will have something akin to below - 1 2 3 4 5 const Route = use("Route"); Route.

Change Date Formats in AdonisJS
· ☕ 3 min read
AdonisJS internally uses moment.js and processes all dates in YYYY-MM-DD format. The format, being an international standard, should have been the standard everywhere. Since it is not, let us see how we can modify the date format. Consider an example - Todo has a end_date field against every record. Your model will look like the below -

Return Related Record Post Saving Record in AdonisJS
· ☕ 1 min read
AdonisJS automatically returns the base/parent record to the caller from the controller. However, you may have to custom code all of one statement to return a related record after the parent record is committed to the database. Consider an example - 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 // TodoController.

Simple Role-based Validation Techniques for AdonisJS
· ☕ 2 min read
AdonisJS does not provide an access control list (ACL) feature out of the box. Here’s are a few simple ways to provide the right access to the right user when using AdonisJS. Use ACL plugins There are two plugins available for AdonisJS - Adonis ACL Advanced Adonis ACL The usage is pretty simple.

Custom Exceptions in AdonisJS
· ☕ 2 min read
AdonisJS provides streamlined ways to raise exceptions in your controller or service code, and raise them in a controlled way to the caller. To create a custom exception - 1 adonis make:exception RecordNotFoundException This will create - 1 √ create app\Exceptions\RecordNotFoundException.js Edit the exception to introduce your own errors.

Track Created By / Modified By for Records in AdonisJS
· ☕ 1 min read
AdonisJS provided a quick way to track created and updated times, but does not provide shortcuts to track the user who created or last updated the record. Doing so is quite easy. Modify the migration script to include created_by_id and updated_by_id. 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 // todoschema.

The Right Way to Receive Parameters in AdonisJS Controller
· ☕ 2 min read
Quickly and easily pass parameters to controller methods from your request. See Start creating your backend application in AdonisJS to get started You can quickly scaffold a controller in Adonis using the following command - 1 adonis make:controller Todo --type http If you want to receive parameters from input, you would do the following -

Create a functional backend in AdonisJS under 5 minutes
· ☕ 5 min read
AdonisJS provides a really quick way to scaffold your way to a great back-end application. Let us start creating a simple to-do app called ‘ado’ in this post. We will see how we can create this with simple commands and have your API ready in no time. Install AdonisJS Download and install Node if you don’t have it in your system.

Why should you use AdonisJS framework?
· ☕ 3 min read
AdonisJS is a great server-side framework built on Express. It’s opinionated way of doing things just makes sense, clears up the initial development problems, and makes development & maintenance easier. I have completed ~3 projects on AdonisJS so far after switching roles to a web application developer last year. After using FeathersJS, Laravel and a bit of .

MeteorJS - Getting Started
· ☕ 3 min read
Meteor is quite an easy Javascript framework to pick up and I have been fascinated getting back to where I left off a couple of years ago. There are quite a few things that you could do in the first week itself, and could even target to complete real-world projects.