Questions tagged [adonis.js]

Adonis is a full stack, open source MVC framework for Node.js. The framework is inspired by the PHP framework Laravel.

AdonisJs is an MVC Framework for Node.js.

It includes:

  • Lucid ORM
  • Database Migrations
  • Authentication System
  • OAuth
  • Mailing System
  • Data Validator
  • Testing

Learn more on the website and check out the organization on Github.

739 questions
1
vote
1 answer

Access app.js function in adonisjs edge template

Can somebody explain to me how you access a function in the .edge template from the app.js file? In resources/js/app.js I have function myFunc() { console.log("works???") } In the edge template I have
Mihai Marinescu
  • 741
  • 8
  • 22
1
vote
0 answers

Best practices to set null field in model with AdonisJS 5 / Lucid

I'm building an API using AdonisJS with PostgreSQL. Some of my entities have optional fields. For example: a user may or may not have a phone number. I'm having trouble deciding the best and most acceptable way to clear an optional field value (e.g.…
Ernani
  • 319
  • 1
  • 4
  • 18
1
vote
1 answer

Adonis npm ci --production hangs

I have problem when deploying an Adonis project, After building, adonis suggest to do npm ci --production inside build folder. And after I do npm ci --production, the process is hangs extractTree: sill extract faker@5.5.3 extracted to…
1
vote
2 answers

Adonisjs How to cast boolean to false and true in a model instead of 0 or 1?

This is my table field (open) but in response, it returns 0 1 but I want true false instead of 0 1 I am using adonis MySQL table.boolean('open').notNullable().defaultTo(true).comment('true = open, false = close') const Model = use('Model') class…
1
vote
1 answer

Ziggy Equivalent for Adonis JS

I want to use Adonis with a Vue3 SPA. Is there a way I could use my adonisJS named routes in the vue client (a package similar to Ziggy for Laravel)? Any pointers will be much appreciated.
Samson Maosa
  • 472
  • 5
  • 11
1
vote
1 answer

Add new column to existing database table

I have created a model and migration using node ace make:migration user and node ace make:model user, now I want to add another column to the user model. How do I add another new column after already creating a model and migration?
Angelin
  • 95
  • 1
  • 9
1
vote
2 answers

Use an existing database with AdonisJS

I'm looking to use AdonisJS with an existing database I made. I only see tutorials and documentation on creating/migrating new tables. I'm struggling to find online content that shows how to integrate Adonis with a previously created SQL database. I…
1
vote
0 answers

Running node ace invoke adonis-mix-asset throws up this error: `invoke` is not a registered command

Ace file: 'use strict' /* |-------------------------------------------------------------------------- | Ace Commands |-------------------------------------------------------------------------- | | The ace file is just a regular Javascript file but…
Ebuka Ubah
  • 11
  • 1
1
vote
1 answer

JSON_VALUE not working in old version. is there any other way in SQL to get a value from a JSON

So the main problem I'm having is that I really need to get a value from another table that is in JSON format, obviously I thought, well just use JSON_VALUE to get the property I want... Problem arises when I created in adonis the migration, and…
1
vote
0 answers

Cannot resolve Nginx 502 Bad Gateway and error of connect() failed (111: Connection refused) while connecting to upstream

I am an amateur programmer and currently lost in deploying my app to a digital ocean cloud server. I followed numerous online tutorials and manage to setup SSH, NodeJS, PM and Nginx. Everything works fine with the Nginx welcome page displayed.…
fullmoon
  • 11
  • 1
1
vote
1 answer

How to get specific field from nested table relation in adonisjs

THIS IS MY CODE QUERY i want to get only some specific field from every table: const project = await Project.query() .where("user_id", user_id) .where('id', project_id) …
1
vote
1 answer

Can't add a new key to object inside an array

I am a newbie in TypeScript const conversations = await Conversation .query() .whereRaw("FIND_IN_SET(" + user_id + ", participants)") .orderBy("last_message_timestamp", "desc") …
Utku Dalmaz
  • 9,780
  • 28
  • 90
  • 130
1
vote
1 answer

Getting error while storing data in db using adonis

I am using below code to put my row details through post request in db but error is coming: (insert into `product` (`created_at`, `description`, `id`, `image`,`pages`, `title`, `updated_at`) values ('2021-02-14 02:44:52', 'sddsds', 12, 'image',…
1
vote
2 answers

How to get the correct count for a Lucid Model's Paginate when joining with additional tables

I have 2 Lucid models: Ad and Campaign, which are associated using a Many:Many relationship. They have a pivot table which manages the relationship which has additional information, so my table structure is as…
JakGuru
  • 101
  • 1
  • 8
1
vote
1 answer

fix adonisjs Unexpected token '.'

In postman I received the following error: Unexpected token '.' app\Controllers\Http\UtilisateurController.js:1:1 C:\Users\Administrator\OneDrive\kya\projectsCode\backend\app\Controllers\Http\UtilisateurController.js 'use strict' /** @typedef…