Skip to content

Commit

Permalink
docs: fix spelling mistakes (adonisjs#18)
Browse files Browse the repository at this point in the history
  • Loading branch information
KevinRouchut committed May 22, 2021
1 parent a0c5c8f commit 846d33b
Show file tree
Hide file tree
Showing 20 changed files with 48 additions and 48 deletions.
6 changes: 3 additions & 3 deletions content/cookbooks/deployment/digial-ocean.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ At the time of deploying your application to the DO apps platform, you will be p
![](https://res.cloudinary.com/adonis-js/image/upload/q_auto,f_auto/v1619105542/v5/do-start-screen.jpg)

## Using database
You can also add the database as a component to your app and then update the environment variables with the database credentials.
You can also add the database as a component to your app and then update the environment variables with the database credentials.

We find Digital ocean database environment variables very generic and recommend re-mapping them as follows:

Expand All @@ -47,7 +47,7 @@ DATABASE=
```

#### Re-mapping them to be specific
You must re-map the enviroment variables to be more specific. For example
You must re-map the environment variables to be more specific. For example

![](https://res.cloudinary.com/adonis-js/image/upload/q_auto,f_auto/v1619105542/v5/do-remmaped-env-vars.jpg)

Expand All @@ -61,6 +61,6 @@ Also, make sure to update the **Run command** to `node build/ace make:migration
![](https://res.cloudinary.com/adonis-js/image/upload/q_auto,f_auto/v1619105809/v5/do-job-component.jpg)

## Managing user uploaded files
Digital ocean apps do not have peristant storage and hence you cannot save the user uploaded files on the server filesystem. This leaves you with only one option of saving the uploaded files to an external service like Digital ocean spaces.
Digital ocean apps do not have persistent storage and hence you cannot save the user uploaded files on the server filesystem. This leaves you with only one option of saving the uploaded files to an external service like Digital ocean spaces.

We are currently working on a module that allows you to use the local filesystem during development and then switch to an external filesystem like Digital ocean spaces for production. Do all this without changing a single line of code.
2 changes: 1 addition & 1 deletion content/cookbooks/deployment/heroku.md
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,6 @@ pg: {
:::

## Managing user uploaded files
Heroku does not have [persistant storage](https://help.heroku.com/K1PPS2WM/why-are-my-file-uploads-missing-deleted), and you cannot save the user uploaded files on the server filesystem. This leaves you with only one option of saving the uploaded files to an external service like S3.
Heroku does not have [persistent storage](https://help.heroku.com/K1PPS2WM/why-are-my-file-uploads-missing-deleted), and you cannot save the user uploaded files on the server filesystem. This leaves you with only one option of saving the uploaded files to an external service like S3.

We are currently working on a module that allows you to use the local filesystem during development and then switch to an external filesystem like S3 for production. Do all this without changing a single line of code.
2 changes: 1 addition & 1 deletion content/cookbooks/testing-adonisjs-apps.md
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,7 @@ The next step is to write a test that interacts the database. But first, let's u

:::tip

You can also configure a separate database for testing by creating `.env.testing` file in the project root and [overwriting the neccessary](../guides/fundamentals/environment-variables.md#defining-variables-while-testing) environment variables.
You can also configure a separate database for testing by creating `.env.testing` file in the project root and [overwriting the necessary](../guides/fundamentals/environment-variables.md#defining-variables-while-testing) environment variables.

:::

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ export default class PostsController {
public async store({ request, session }: HttpContextContract) {
// insert-end

// ... Collpased existing code
// ... Collapsed existing code
console.log(payload)

// delete-start
Expand Down
6 changes: 3 additions & 3 deletions content/guides/auth/api-tokens-guard.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ The API tokens guard allows you store tokens either in a SQL database or store t
### SQL storage
The SQL storage is suited when api tokens are not primary mode of authentication. For example: You may want to allow the users of your application to create personal access tokens (just like the way github does) and authenticate the API requests using that.

In this scanerio, you will not generate too many tokens in bulk and also most of the tokens will live forever.
In this scenario, you will not generate too many tokens in bulk and also most of the tokens will live forever.

Configuration for tokens is managed inside the `config/auth.ts` file under the guard config object.

Expand Down Expand Up @@ -55,7 +55,7 @@ The foreign key to build the relationship between the user and the token. Later,
### Redis storage
The redis storage is suitable when API tokens are the primary mode of authentication. For example: You authenticate the requests from your mobile app using token based authentication.

In this scanerio, you would also want tokens to expire after a given period of time and redis can automatically clear the expired tokens from its storage.
In this scenario, you would also want tokens to expire after a given period of time and redis can automatically clear the expired tokens from its storage.

Configuration for tokens is managed inside the `config/auth.ts` file under the guard config object.

Expand Down Expand Up @@ -369,7 +369,7 @@ Reference to the underlying user provider used by the guard.

---

### tokenProvidier
### tokenProvider
Reference to the underlying token provider used by the guard.

---
Expand Down
12 changes: 6 additions & 6 deletions content/guides/auth/introduction.md
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ You can also configure new guards and the providers after initial setup. The fir

You can add a new provider inside the `ProvidersList` interface. The key is the name of provider, alongside the types for both the config and the implementation.

The `GuardsList` interface is the list of all the guards you want to use. The key is the name of the guard, alonside the types for both the guard config and its implementation.
The `GuardsList` interface is the list of all the guards you want to use. The key is the name of the guard, alongside the types for both the guard config and its implementation.

```ts
// title: contracts/auth.ts
Expand Down Expand Up @@ -149,11 +149,11 @@ Once, you have added the new guard(s) or provider(s) inside the contracts file,

The setup process also creates the migration files for the `users` table and optionally for the `tokens` table (if using the API tokens guard with SQL storage).

The filename of the migrations uses the current timestamp and is placed after all the existing migrations.
There are chances that some of your tables needs to create a foreign key constraint with the `users` table, hence the `users` table migration must run before those migrations.
In this scanerio, you can manually rename the `users` table migration file and use a smaller timestamp to move it ahead of the other migration files.
The filename of the migrations uses the current timestamp and is placed after all the existing migrations.

There are chances that some of your tables needs to create a foreign key constraint with the `users` table, hence the `users` table migration must run before those migrations.

In this scenario, you can manually rename the `users` table migration file and use a smaller timestamp to move it ahead of the other migration files.

## Usage
You can access the `auth` instance inside your route handlers using the `ctx.auth` property. The auth object allows you to both login users and authenticate subsequent requests.
Expand Down
2 changes: 1 addition & 1 deletion content/guides/database/introduction.md
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ Route.get('posts', async ({ request }) => {
})
```

You are not only limited to the select queries. You can also use the query builder to perform **upates**, **inserts** and **deletes**.
You are not only limited to the select queries. You can also use the query builder to perform **updates**, **inserts** and **deletes**.

#### Insert a new row

Expand Down
2 changes: 1 addition & 1 deletion content/guides/database/query-builder.md
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ await Database.table('users').multiInsert([
## Raw queries
Raw queries allows to execute a SQL statement from a string input. This is usually helpful, when you want to execute complex queries that are not supported by the standard query builder.

You can create an instance of the raw query builder using the `.rawQuery` metho. It accepts the SQL string as the first argument and its positional/named bindings as the second argument.
You can create an instance of the raw query builder using the `.rawQuery` method. It accepts the SQL string as the first argument and its positional/named bindings as the second argument.

```ts
import Database from '@ioc:Adonis/Lucid/Database'
Expand Down
12 changes: 6 additions & 6 deletions content/guides/digging-deeper/ace.md
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ import {

export default class Greet extends BaseCommand {
public static commandName = 'greet'

// highlight-start
@args.string({ description: 'Name of the person to greet' })
public name: string
Expand Down Expand Up @@ -585,7 +585,7 @@ await this.prompt.enum('Define tags', {
<tr>
<td><strong>default</strong></td>
<td>
<p>The default value to use, when no inout has been provided</p>
<p>The default value to use, when no input has been provided</p>

```ts
{
Expand Down Expand Up @@ -652,7 +652,7 @@ await this.prompt.enum('Define tags', {
if (!value) {
return 'Enter value'
}

return true
}
}
Expand All @@ -679,13 +679,13 @@ export default class Greet extends BaseCommand {
this.logger.debug('Something just happened')
this.logger.success('Account created')
this.logger.info('Message with time prefix', '%time%')

const spinner = this.logger.await(
'installing dependencies'
undefined,
'npm install --production'
)

// perform some task
spinner.stop()
}
Expand Down Expand Up @@ -953,7 +953,7 @@ await this.generator.run()
```

## Lifecycle hooks
Commands can define the following lifecycle hooks.
Commands can define the following lifecycle hooks.

The `prepare` method is executed before running the run method.
And the `completed` method is executed after the run method.
Expand Down
6 changes: 3 additions & 3 deletions content/guides/fundamentals/adonisrc-file.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ node ace dump:rcfile
Following is the output of the file, along with the defaults and you can override any property as per your requirements.

```json
// collpase: 16
// collapse: 16
{
"typescript": true,
"directories": {
Expand Down Expand Up @@ -236,7 +236,7 @@ AdonisJS aliases are for runtime only. You will also have to register the same a
The `metaFiles` array accepts the files that you want AdonisJS to copy to the `build` folder, when creating the production build.

- You can define the file paths as a glob pattern and we will copy all the matching files for that pattern.
- Also, you can instruct the development server to reload, if any of the files inside the matching pattern changes.
- Also, you can instruct the development server to reload, if any of the files inside the matching pattern changes.

```json
{
Expand Down Expand Up @@ -297,7 +297,7 @@ An array of service providers to load during the application boot cycle. The pro
"providers": [
"./providers/AppProvider",
"@adonisjs/core"
],
],
}
```

Expand Down
6 changes: 3 additions & 3 deletions content/guides/fundamentals/deployment.md
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ You can migrate your production database using the `node ace migration:run --for

### When to migrate

Also, you must always run the migrations before restarting the server. If the migration fails, then do not restart the server.
Also, you must always run the migrations before restarting the server. If the migration fails, then do not restart the server.

If you are using a managed service like Cleavr or Heroku, they can automatically handle this use case. Otherwise, you will have to run the migration script inside a CI/CD pipeline or run it manually by SSHing to the server.

Expand Down Expand Up @@ -129,7 +129,7 @@ When deploying your AdonisJS application on multiple servers, make sure to run t
For MySQL and PostgreSQL, Lucid will obtain [advisory locks](https://www.postgresql.org/docs/9.4/explicit-locking.html#ADVISORY-LOCKS) to ensure that concurrent migration is not allowed. However, it is better to avoid running migrations from multiple servers in the first place.

## Persistent storage for file uploads
Modern-day deployment platforms like ECS, Heroku, or Digital ocean apps run your application code inside [ephemeral filesystem](https://devcenter.heroku.com/articles/dynos#ephemeral-filesystem), which means that each deployment will nuke the existing filesystem and creates a fresh one.
Modern-day deployment platforms like AWS ECS, Heroku, or Digital ocean apps run your application code inside [ephemeral filesystem](https://devcenter.heroku.com/articles/dynos#ephemeral-filesystem), which means that each deployment will nuke the existing filesystem and creates a fresh one.

You will lose the user uploaded files if they are stored within the same storage as your application code. Hence, it is better to use [third party cloud storage](../http/file-uploads.md#moving-files-to-the-cloud-storage) for storing user-uploaded files.

Expand All @@ -156,7 +156,7 @@ import Application from '@ioc:Adonis/Core/Application'

Event.on('db:query', (query) => {
if (Application.inProduction) {
Logger.debug(query)
Logger.debug(query)
} else {
Database.prettyPrint(query)
}
Expand Down
10 changes: 5 additions & 5 deletions content/guides/fundamentals/typescript-build-process.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ We started with the following set of goals.
- All the configuration should be managed by the existing `tsconfig.json` file.
- If the code runs in development, then it should run in production too. Meaning, do not use two completely different development and production tools and then teach people how to adjust their code.
- Add lightweight support for copying static files to the final build folder. Usually, these will be the edge templates.
- **Make sure the REPL can also run the TypeScript code as first class citizen. All of the above approaches, except `ts-node` cannot compile and evaluate the TypeScript code directly.**
- **Make sure the REPL can also run the TypeScript code as first class citizen. All of the above approaches, except `ts-node` cannot compile and evaluate the TypeScript code directly.**

## In-memory development compiler
Similar to ts-node, we created [@adonisjs/require-ts](https://github.com/adonisjs/require-ts) module. It uses the TypeScript compiler API, meaning all the TypeScript features works, and your `tsconfig.json` file is the single source of truth.
Expand All @@ -68,14 +68,14 @@ You build your code production by running the `node ace build --production` comm
- Build your frontend assets using Webpack encore (only if it is installed).
- Use the TypeScript compiler API to compile the TypeScript code to JavaScript and write it inside the `build` folder. **This time, we do perform type checking and report the TypeScript errors**.
- Copy all the static files to the `build` folder. The static files are registered inside the `.adonisrc.json` file under the `metaFiles` array.
- Copy the `package.json` and `package-lock.json/yarn.lock` to the `build` folder.
- Copy the `package.json` and `package-lock.json/yarn.lock` to the `build` folder.
- Generate the `ace-manifest.json` file. It contains an index of all the commands your project is using.
- That is all.

---

#### Why do we call it a standalone build?
After running the `build` command, the output folder has everything you need to deploy your application in production.
After running the `build` command, the output folder has everything you need to deploy your application in production.

You can copy the `build` folder without your TypeScript source code, and your application will work just fine.

Expand All @@ -91,9 +91,9 @@ Creating a standalone `build` folder does help in reducing the size of code that
cd build
node server.js
```
- You must install production-only dependencies inside the `build` folder.
- You must install production-only dependencies inside the `build` folder.
```sh
cd build
npm ci --production
```
- We do not copy the `.env` file to the output folder. Because the environment variables are not transferrable, you must define environment variables for production separately.
- We do not copy the `.env` file to the output folder. Because the environment variables are not transferable, you must define environment variables for production separately.
2 changes: 1 addition & 1 deletion content/guides/http/context.md
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ export default class UserLocationMiddleware {
}
```

Here we have added a custom `location` property to the `ctx`, which you can access inside the route handler or the upcoming middlewares.
Here we have added a custom `location` property to the `ctx`, which you can access inside the route handler or the upcoming middleware.

### Informing typescript about the custom property

Expand Down
6 changes: 3 additions & 3 deletions content/guides/http/request.md
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ request.param('id', 1)

### Request body

The request body is parsed using the pre-configured bodyparser middleware. Open the `start/kernel.ts` file and ensure that the following middleware is registered inside the list of the global middlewares.
The request body is parsed using the pre-configured bodyparser middleware. Open the `start/kernel.ts` file and ensure that the following middleware is registered inside the list of the global middleware.

```ts
// title: start/kernel.ts
Expand Down Expand Up @@ -353,7 +353,7 @@ The `request.ips()` method returns an array of IP addresses starting from the mo
request.ips()
```

### Custom IP reterval method
### Custom IP retrieval method

If the trusted proxy settings are not enough to determine the correct IP address, you can implement your own custom `getIp` method.

Expand Down Expand Up @@ -564,7 +564,7 @@ The following methods from the request class rely on a trusted proxy to return t

- **hostname**: The value of `request.hostname()` is derived from the `X-Forwarded-Host` header.
- **protocol**: The value of `request.protocol()` is derived from the `X-Forwarded-Proto` header.
- **ip/ips**: The value of `request.ips()` and `request.ip()` is derived from the `X-Forwaded-For` header. However, the `http.getIp` configuration method takes precendence when defined. [Learn more](#custom-ip-reterval-method)
- **ip/ips**: The value of `request.ips()` and `request.ip()` is derived from the `X-Forwaded-For` header. However, the `http.getIp` configuration method takes precedence when defined. [Learn more](#custom-ip-reterval-method)

## CORS

Expand Down
2 changes: 1 addition & 1 deletion content/guides/http/response.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ The automatic **content type** header is only defined when you don't set it expl
:::

- Content type is set to `application/json` for arrays and objects.
- It is set to `text/html` for HTML fragements.
- It is set to `text/html` for HTML fragments.
- JSONP responses are sent with the `text/javascript` content type.
- For everything else, we set the content type to `text/plain`.

Expand Down
4 changes: 2 additions & 2 deletions content/guides/http/session.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ node ace configure @adonisjs/session
```

```ts
// title: Validate environment variables
// title: Validate environment variables
/**
* Make sure to add the following validation rules to the
* `env.ts` file to validate the environment variables.
Expand Down Expand Up @@ -445,7 +445,7 @@ Find if the store has been initiated in `readonly` mode or not.

:::note

During HTTP requests, the store is **NEVER** in read-only mode. This flag is reserved for the future to have a read-only session for Websockets connections.
During HTTP requests, the store is **NEVER** in read-only mode. This flag is reserved for the future to have a read-only session for WebSocket connections.

:::

Expand Down
4 changes: 2 additions & 2 deletions content/guides/installation.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ Optionally, you can configure Eslint and prettier. Both the packages are configu
---

#### Configure webpack encore
Optionally, you can also configure [webpack encore](./http/assets-manager.md) to bundle and serve frontend dependencies.
Optionally, you can also configure [webpack encore](./http/assets-manager.md) to bundle and serve frontend dependencies.

Do note, AdonisJS is a backend framework and does not concern itself with frontend build tools. Hence the webpack setup is optional.

Expand All @@ -61,7 +61,7 @@ After creating the application, you can start the development server by running
node ace serve --watch
```

- The `serve` command starts the HTTP server and performs in-memory compilition of TypeScript to JavaScript.
- The `serve` command starts the HTTP server and performs in-memory compilation of TypeScript to JavaScript.
- The `--watch` flag is meant to watch the file system for changes and restart the server automatically.

## Compiling for production
Expand Down
Loading

0 comments on commit 846d33b

Please sign in to comment.