adonisjs / v5-docs Goto Github PK
View Code? Open in Web Editor NEW📚 Source code and documentation for the official docs website.
Home Page: https://v5-docs.adonisjs.com
📚 Source code and documentation for the official docs website.
Home Page: https://v5-docs.adonisjs.com
15.0.1
14.17.0, 6.14.3
Trying to implement beforePaginate as the suggested solution to adonisjs/lucid#647 using the documented example at (https://docs.adonisjs.com/reference/orm/decorators#beforepaginate)
import { beforePaginate, BaseModel } from '@ioc:Adonis/Lucid/Orm'
class Post extends BaseModel {
@beforePaginate()
public static withoutSoftDeletes(query) {
query.whereNull('deleted_at')
}
}
returns the following error
query.whereNull is not a function
Hi, is there any plan to add docs with recommendations on how to write a package? Looking for conventions, and even more than that how to test those. Something like https://docs.adonisjs.com/cookbooks/testing-adonisjs-apps, but for packages.
Inspiration:
none
On the API Tokens page it's stated that the database is the best options for secondary auth while redis is best for the main form of auth. This seems fine to me but I think it would be a lot clearer with another line explaining the reason why the database or redis are more suited to the task.
No response
Trying to get start with database printed the message above in the terminal
latest
It took me a bit to validate additional request properties alongside the request body. An example on how to do so would likely save others some time.
No response
Originally posted by sergefabre September 13, 2021
Hello,
I'm following the example on the docs about the flags.boolean decorator, but the property does not exist with my version of Adonis.
Here is an extract of my package.json file:
"dependencies": {
"@adonisjs/ally": "^4.1.1",
"@adonisjs/auth": "^8.0.9",
"@adonisjs/core": "^5.3.4",
"@adonisjs/lucid": "^16.0.0",
"@adonisjs/repl": "^3.1.6",
"@adonisjs/view": "^6.1.0",
Here is the problem in my IDE (VS Code):
Telling me that default
does not exist in the type Partial<Omit<CommandFlag, "type" | "propertyName">>
.
I don't know if I'm doing something wrong, or if the docs are for a more recent or dev version (it doesn't show up in the docs website, you used to be able to do this with the legacy docs).
I'm creating a dictionary table. Immediately after creation, it must be filled with certain static data. I take an example from the documentation, but it doesn't work:
this.defer(async (db) => {
const users = await db.select('*').from('users') // TS2339: Property 'select' does not exist on type 'QueryClientContract'.
await Promise.all(users.map((user) => {
return db
.table('user_emails')
.insert({ user_id: user.id, email: user.email })
}))
})
And runtime error:
[ error ] db.select is not a function
"@adonisjs/core": "5.7.5",
"@adonisjs/lucid": "17.2.0",
8.3.1
On the installation page, Cloudflare replaces
npm init adonis-ts-app@latest hello-world
with:
npm init [email protected] hello-world
This can be fixed by disabling thee Cloudflare's Email Address Obfuscation feature.
Official spec example from here link seems not to work,
running version : "@adonisjs/core": "^5.6.0"
it dose not have file.createPng('1mb')
method and fakeDrive.hasFile()
method,
and if follow the import { file } from '@ioc:Adonis/Core/Helpers'
it can get a new file.generatePng()
method there, but as the same time .file('avatar', fakeAvatar)
will get fail because of the type error
hoping the team can update the new doc to help people get into the adonis more easily.
n/a
The documentation for /Cookbooks/dockerize-adonis/ is incomplete by omitting what to do about the APP_KEY
value. Following the instructions verbatim, and copy/pasting the config files here verbatim will result in the following output in the container's log.
2023-08-29 14:10:18 Exception: E_MISSING_ENV_VALUE: Missing environment variable "APP_KEY"
2023-08-29 14:10:18 at ensureValue (/home/node/app/node_modules/@adonisjs/env/build/src/Schema/helpers.js:26:15)
2023-08-29 14:10:18 at Object.validate [as APP_KEY] (/home/node/app/node_modules/@adonisjs/env/build/src/Schema/string.js:45:35)
2023-08-29 14:10:18 at /home/node/app/node_modules/@adonisjs/env/build/src/Env/index.js:87:60
2023-08-29 14:10:18 at Array.forEach (<anonymous>)
2023-08-29 14:10:18 at Env.process (/home/node/app/node_modules/@adonisjs/env/build/src/Env/index.js:86:44)
2023-08-29 14:10:18 at Application.loadEnvironmentVariables (/home/node/app/node_modules/@adonisjs/application/build/src/Application.js:303:18)
2023-08-29 14:10:18 at Application.setup (/home/node/app/node_modules/@adonisjs/application/build/src/Application.js:518:14)
2023-08-29 14:10:18 at AppKernel.boot (/home/node/app/node_modules/@adonisjs/core/build/src/Ignitor/Kernel/index.js:55:32)
2023-08-29 14:10:18 at HttpServer.start (/home/node/app/node_modules/@adonisjs/core/build/src/Ignitor/HttpServer/index.js:85:31)
2023-08-29 14:10:18 at Object.<anonymous> (/home/node/server.ts:21:4)
2023-08-29 14:11:34 {"level":30,"time":1693332694392,"pid":8,"hostname":"4cbf60af4c7b","name":"my-project-api","msg":"started server on 0.0.0.0:3333"}
The APP_KEY
value is never mentioned in this guide.
No response
@adonisjs/lucid:18.1.0
In this page, the withCount exemple return a key in camelCase but reading the code, it should be in snake_case!
No response
Our vendor databases use bigint
as the primary key which is rather annoying.
Out of the box lucid (mysql driver) doesn't appear to support it.
After a few hours of trying to find a solution there is a setting that can be enabled to support this.
connections: {
mysql: {
client: 'mysql',
connection: {
host: Env.get('MYSQL_HOST'),
port: Env.get('MYSQL_PORT'),
user: Env.get('MYSQL_USER'),
password: Env.get('MYSQL_PASSWORD', ''),
database: Env.get('MYSQL_DB_NAME'),
supportBigNumbers: true, // <---- here
},
migrations: {
naturalSort: true,
},
healthCheck: false,
debug: false,
},
}
Can you please add this to the documentation regarding supportBigNumbers: true
as it would save a lot of headaches.
Thanks
5.8.4
Link of documentation: https://docs.adonisjs.com/guides/database/introduction#drivers-config
The documentation guides us to install the package mysql2 but in the config example the client used is mysql. After I changed it to mysql2 the config started to work.
Also, the code generated by node ace configure @adonisjs/lucid generates a file with a comment that instructs to install mysql instead of mysql2.
No response
latest
GET Http method was not listed with example in the HTTP methods
No response
With the prefers-reduced-motion
mode requested, the side drawers are still heavily animated.
Ideally, animations should be disabled.
I've noticed that the https://github.com/adonisjs/fold repo links to https://preview.adonisjs.com/packages/ioc-container for it's documentation. That link redirects to https://docs.adonisjs.com/packages/ioc-container, which is a 404.
Searching the docs for fold didn't really help either.
Documentation of Query Scopes
- https://docs.adonisjs.com/guides/models/query-scopes appears to be incorrect.
The ModelQueryBuilderContract
does not appear to have a function called withScopes
, after looking through the tests, it appears it should be apply
e.g.
Post
.query()
.withScopes((scopes) => scopes.published())
should be
Post
.query()
.apply((scopes) => scopes.published())
It is correct in the reference page - https://docs.adonisjs.com/reference/orm/query-builder#apply
Hello,
In the docs, at the base model section for the load function, we can read this
await user.load((loader) => {
loader.load('profile', (profile) => {
profile.load('socialAccounts')
}).load('posts')
})
but in my application, load
on profile doesn't exist. We must use preload
await profile.load((loader) => {
loader.load('insameeProfile', (insameeProfile) => {
insameeProfile.preload('associations')
})
})
Documentation for Custom messages with wildcard callback is missing types for it's parameters.
I've assumed types are correct at MessageBag.
const wildCardError = (
field: string,
rule: string,
arrayExpressionPointer?: string,
options?: any
) => {
return `${rule} validation error on ${field}`
}
{
messages: {
'*': wildCardError,
'username.required': 'Username is required to sign up',
}
}
After the latest release String documentation is missing escape and trim rules.
why my assets files always deleted by webpack-encore while compiling (npm run dev) like on the pic, while creating the adonisjs project I choose "true" for configure webpack-encore. I newbie at webpack or something like that, please help me I'm so stuck here. thanks for the answer and I appreciate it. 😄😄
https://docs.adonisjs.com/reference/database/table-builder#dropunique
I got a typescript error when using
table.dropUnique('email')
but the following one work fine
table.dropUnique(['email'])
This issue might apply to other drop*()
methods I didn't checked that
Hi guys,
Thank you for the great work on v6! However the v5 docs are pointing to v6 results. See the link in bottom left corner.
Expected helper link: https://v5-docs.adonisjs.com/guides/helpers
Carl
In the global transactions documentation, I think the cleanup function should be an async function and should have the await keyword.
Currently, it is return () => Database.rollbackGlobalTransaction()
, I think it should be: return async () => await Database.rollbackGlobalTransaction()
, since the rollbackGlobalTransaction()
function returns a promise.
I can open a PR, just wanted to make sure this wasn't intentional.
First thing you should do is reply to this issue picking one of the following topics that have 💤. After that go to this repo and fork it. Create a branch with the name of the topic you pick and start translating each subsection.
After you finish the translation of your topic, submit a PR on the branch pt-translation-merging
. Other translator should check your translation for misspelling and translating conventions.
Absolutely. Please look at our Translation conventions table in the end of this issue
It's essentialy the same process. Have someone fork your repo, create a branch with the subtopic translation, and submit to your topic branch as a PR. You can review his PR and get all the help you need. You can use this issue to call for help.
💤 No fork :zzz:
✍🏼 forked :writing_hand:
👀 fork under review :eyes:
📗 translation merged :green_book:
📗 introduction-installation-release
✍️ Fundamentals @guntribam/Fundamentals
💤 Http
💤 Views & Templates
💤 Validator
💤 Database
💤 ORM
💤 Authentication
💤 Security
💤 Digging deeper
💤 First Section(Connection, Connection manager, etc)
💤 ORM
💤 Relationships
💤 Schema types
💤 Validation rules
💤 Globals
💤 Tags
💤 Using socket.io
💤 Writing tests
💤 Deployment
💤 Validator
💤 Out of preview
💤 December release -2020
💤 October release -2020
💤 August release -2020
💤 Introducing AdonisJS V5 Preview
English | Portuguese |
---|---|
breaking changes | - mudanças não retrocompatíveis - quebras de código |
framework | framework |
build | construção |
release | - lançamento - liberação |
Hi. I was trying the other day to use the new version of the framework to achieve something like Spring Boot does in Java with with it's IOC Container, and I noticed that website lacks a little more information about this. I wanted to write something like:
export default interface FooRepositoryInterface {
findAll(): Promise<Foo>
}
export default class FooRepository implements FooRepositoryInterface{
findAll(): Promise<Foo> {
// Implementation
}
}
export default interface FooServiceInterface {
list(): Promise<Foo>
}
export default class FooService implements FooServiceInterface {
constructor(public FooRepositoryInterface repository) {}
list(): Promise<Foo> {
return repository.findAll()
}
}
export default class FooController {
constructor(public FooServiceInterface service) {}
index() {
service.list()
}
}
It is possible to achieve this kind of behavior with the current version of the framework? If it is, could you guys provide me some examples or guides in how to register the dependencies on the IOC container correctly? I tried to register the classes on the provider but I could achieve the result I wanted.
Thanks in advance.
N/A
As a developer, I would expect the documentation on "docs.adonisjs.com" to reflect what is currently possible, and not documentation for features that have yet to be released.
For instance, this is currently not possible:
https://docs.adonisjs.com/guides/testing/introduction#truncate-database-after-each-run-cycle
It wasn't until after updating Adonis and searching around did I figure out that it's still a feature sitting in the develop branch of adonisjs/lucid
, and not something that is currently available to me.
Just thought I'd throw this out there, in the hopes that this is taken into consideration in the future, for a better developer experience. I'm also not sure if this something is already being considered and this slipped by, or if there's just no formal process for ensuring that the feature is available before it lands on the docs.
No response
Please notify us about the translation you are maintaining and the associated repo. Also make sure to subscribe to this issue to receive documentation updates notifications
I was reading through the documentation for redirectToUrl
-> https://docs.adonisjs.com/guides/routing#redirecttourl
and when I tried to test it out it does not work. I found with the help of VSCode that what works is redirectToPath
.
was redirectToUrl
depracated in favour of redirectToPath
? If so, then I think a change should be reflected in the documentation.
I can put in a PR, if it is fine
On the documentation it says to install the following
npm i mysql2
but it says to use it
mysql: {
client: 'mysql',
connection: {
host: Env.get('MYSQL_HOST'),
port: Env.get('MYSQL_PORT'),
user: Env.get('MYSQL_USER'),
password: Env.get('MYSQL_PASSWORD', ''),
database: Env.get('MYSQL_DB_NAME'),
},
migrations: {
naturalSort: true,
},
healthCheck: false,
debug: false,
}
i am not quite sure if this is a bug or its supposed to work that way, i changed the client: 'mysql' to 'mysql2' and it worked, could you confirm?
this should solve mysql 8.* issues
Hi bros,
Just to quick check with you guys whether have guides to setup websocket with Adonisjs using ws library instead of socket.io
I saw this:
https://docs.adonisjs.com/cookbooks/socketio-with-adonisjs
Hope to get some guide on integrate with ws
Is this repo opensource? If so, put license.
how to write Adonis5 in JavaScript with no need Typescript?
the sentence As per the standards today, the CSS and the frontend JavaScript need to transpiled and minified before serving it to the browser is missing the be
before transpiled
I was looking to see if this rule exists, but the documentation for it appears to be incomplete, so I figured I'd log an issue here.
Content:
unsigned
NEED TO RE-THINK
https://docs.adonisjs.com/reference/validator/rules/unsigned
I noticed that whenever im working on macOS the docker-compose, argon2 and bcrypt issues arise
turned out
volumes:
- ./:/home/node/app
is linking the container to the node_modules on the host so
- /home/node/app/node_modules
adding this will exclude the node_modules usage from host, and creates an anonymous volume that holds the node_modules, thought it solves the issue, what its doing actually is creating a new "node_modules" which means we end up with 3 places with node_modules, not a very pretty solution,
Sadly this solution needs an image rebuild each time the package.json is updated
Reference:
https://burnedikt.com/dockerized-node-development-and-mounting-node-volumes/
In https://docs.adonisjs.com/guides/auth/basic-auth-guard , one link is not connected. I suggest:
You can also make use of the [auth middleware]()
to guard routes using the basic auth guard.
->
You can also make use of the [auth middleware](./middleware.md)
to guard routes using the basic auth guard.
In Authorization - Using different User models
The docs mention to Check out the following video as an example of the same. but there's no video after
In the doc insomnia V5 => https://docs.adonisjs.com/reference/validator/rules/mobile#document
It says locales, but rule.mobile... accept just locale
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.