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
2
votes
2 answers

Relation and inverse relation not working together Adonis JS

I have 3 model Country, State, City country.js state () { return this.hasMany(State, 'id', 'country_id') } state.js city () { return this.hasMany(City, 'id', 'state_id') } stateCountry () { return this.belongsTo(Country,…
Sujal Patel
  • 2,444
  • 1
  • 19
  • 38
2
votes
1 answer

Capture error 401 adonis.js error E_INVALID_SESSION: Invalid session

I have a login developed in adonis and the routes already have the .middleware ('auth') to guarantee that they are only used when the user has made the entry, but when he has not done it the error 401 E_INVALID_SESSION: Invalid session, I want…
SyQual 10 S.A.S
  • 75
  • 1
  • 10
2
votes
1 answer

How to wait the return of my python function and how to return the data in my response body with my controller nodejs?

I'm trying to run a function in python which returns me values from a PDF file, I upload the file into the controller written in nodejs, I call the python function with PythonShell. I'd like my controller to wait to solve my python function so I can…
2
votes
2 answers

How to foreach loop data in Controller using addonisjs

How to foreach data and update data in loop using adonisjs I wannt to do something like this in php I do this $emp = Employee::all() foreach($emp as $data) { $emp_store = Store::where('emp_id', $emp->id); $emp_store->name = $emp_name; …
TryHard
  • 299
  • 4
  • 19
2
votes
2 answers

Adonis Lucid ORM Not Returning data

I am new to Adonis JS so extremely sorry for the Stupid Question. I have the default setup of Adonis JS with Mysql Database and everything working. I have created a simple usertest route where I am returning JSON of user with ID: 1. Below is the…
Akshay Khale
  • 8,151
  • 8
  • 50
  • 58
2
votes
0 answers

not able to get request,file() working in adonisjs post

when I try to call the request of both the text and the file I don't get a response. postman just show 200 and nothing is updated to the database. 'use strict'; const Pendingupload = use('App/Models/Pendingupload'); const Helpers =…
2
votes
1 answer

Can Javascript be written in .edge file?

I just started learning Adonis.js and I would like to know if it's possible to write Javascript in an .edge file? I've found this tutorial (here) on how to add table row dynamically and I want to implement this in my Adonis.js project. I've add the…
quratulhzm
  • 33
  • 1
  • 7
2
votes
0 answers

adonis js and angular 6 csrf

I am creating an SPA using Angular 6 for front end and Adonisjs for backend. And now I got stuck in the problem csrf. If I disable csrf in adonis/config/shield.js I have complete my task. But, I don't want to disable csrf. I have followed some…
Sulaiman Triarjo
  • 333
  • 3
  • 15
2
votes
2 answers

Automating/Tracking Knex Migrations and Lucid Models

The Situation I recently started working on a new project using nodejs. I have a background of using Python/Django and C#/.NET (not a huge fan of the latter). Node is awesome, but I must say I miss the ease of building models and automating…
2
votes
2 answers

Is it possible to show a log of database queries in AdonisJs?

Ruby on Rails allows seeing a log of the queries made to the database in all environments (dev, test, production). Is there a way one can replicate such functionality in Adonis.js?
rfrm
  • 228
  • 2
  • 9
2
votes
3 answers

AdonisJS no default values for timestamps

I have created basic schema with timestamps, but when I insert into table in seeder, column created_at and updated_at are null, but based on the Knex.js documentation I thought it should be current datetime if not specified. Latest adonis libraries,…
Tomas Bruckner
  • 718
  • 2
  • 10
  • 22
2
votes
2 answers

SyntaxError: Unexpected identifier - Received when trying to seed data with AdonisJS

I have changed both files as far as commas and semicolons, both of which have been driving eslint crazy. Nothing seems to appease it within factory.js especially, but the odd error messages that I am getting below make me think this may be something…
Darren Cook
  • 115
  • 1
  • 2
  • 12
2
votes
2 answers

How to get CSRF token from AdonisJs in VueJs?

I work on a project with an API made with AdonisJS and a front end made with VueJS. The API and the front are independant and the front consumes the API with axios calls. I'm trying to make a POST request with axios from the front, but the request…
Pochwar
  • 646
  • 5
  • 15
2
votes
1 answer

AdonisJs migrations solution for many to many

I was wondering how I can solve a many to many solutions with migrations like at this diagram: DB relation diagram u_id_user is a FK from the User table u_g_id is unique and auto-increment g_id_group is a FK from Group Code example: class…
2
votes
2 answers

How to send json response back in adonis js with a status code like 401?

I am trying to send a json response back to the application with a status code. This what I tired but didn't work. if (validation.fails()) { console.log(validation.messages()) return response.json(validation.messages(),false,401) // or…
Hkm Sadek
  • 2,987
  • 9
  • 43
  • 95