Skip to content

Commit

Permalink
Remove mentions of Mongoose
Browse files Browse the repository at this point in the history
  • Loading branch information
LoicPoullain committed Jun 18, 2020
1 parent ba21697 commit 5ff8daa
Show file tree
Hide file tree
Showing 8 changed files with 14 additions and 25 deletions.
4 changes: 2 additions & 2 deletions .github/CONTRIBUTING.MD
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,8 @@ FoalTS is based on very few dependencies for all these reasons:
- The installation is often polluted by messages of indirect dependencies in search of funds.
Some packages, however, can override this policy and be installed if they meet one of the following criteria:
- Rewriting the entire package would require too much work and would be difficult to maintain in the long term. Examples: `TypeORM`, `Mongoose`.
- The code requires very specific knowledge. Examples: `pump`, `jsonwebtoken`, `TypeORM`, `Mongoose`.
- Rewriting the entire package would require too much work and would be difficult to maintain in the long term. Example: `TypeORM`.
- The code requires very specific knowledge. Examples: `pump`, `jsonwebtoken`, `TypeORM`.
- The packages are base packages of the Express.Js framework and can therefore be considered stable, safe and mature. Examples: `cookie-parser`, `morgan`.
> Dependencies (except peer ones) should point to *minor* versions (`~1.2.0` instead of `^1.2.0`).
Expand Down
2 changes: 0 additions & 2 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -100,8 +100,6 @@ jobs:
run: cd packages/jwt && npm run test
- name: Run unit tests of @foal/mongodb
run: cd packages/mongodb && npm run test
- name: Run unit tests of @foal/mongoose
run: cd packages/mongoose && npm run test
- name: Run unit tests of @foal/password
run: cd packages/password && npm run test
- name: Run unit tests of @foal/redis
Expand Down
2 changes: 1 addition & 1 deletion docs/SUMMARY.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
* [SQL Databases (TypeORM)](./databases/typeorm.md)
* [Create Models & Queries](./databases/create-models-and-queries.md)
* [Generate & Run Migrations](./databases/generate-and-run-migrations.md)
* [MongoDB (TypeORM or Mongoose)](./databases/mongodb.md)
* [MongoDB (TypeORM)](./databases/mongodb.md)
* [Use Another ORM](./databases/using-another-orm.md)
* Authentication & Access Control
* [Quick Start](./authentication-and-access-control/quick-start.md)
Expand Down
14 changes: 7 additions & 7 deletions docs/authentication-and-access-control/jwt.md
Original file line number Diff line number Diff line change
Expand Up @@ -283,7 +283,7 @@ In these cases, the two hooks `JWTRequired` and `JWTOptional` offer a `user` opt

- The hook must be provided a function that takes a string id (the `subject`) as parameter and returns the value of the `Context.user`. If the function returns `undefined`, the hooks returns an error *401 - UNAUTHORIZED*.

*Example with TypeORM*
*Example with TypeORM (SQL database)*
```typescript
import { Context, Get } from '@foal/core';
import { JWTRequired } from '@foal/jwt';
Expand All @@ -302,20 +302,20 @@ In these cases, the two hooks `JWTRequired` and `JWTOptional` offer a `user` opt
}
```

*Example with Mongoose*
*Example with TypeORM (MongoDB)*
```typescript
import { Context, Get } from '@foal/core';
import { JWTRequired } from '@foal/jwt';
import { fetchUser } from '@foal/mongoose';
import { fetchMongoDBUser } from '@foal/typeorm';

import { User } from '../models';
import { User } from '../entities';

// fetchUser fetches the user from the database using the model User. It returns an instance of User.
@JWTRequired({ user: fetchUser(User) })
// fetchMongoDBUser fetches the user from the database using the entity User. It returns an instance of User.
@JWTRequired({ user: fetchMongoDBUser(User) })
export class ApiController {
@Get('/do-something')
get(ctx: Context) {
// ctx.user is the instance returned by fetchUser.
// ctx.user is the instance returned by fetchMongoDBUser.
// ...
}
}
Expand Down
2 changes: 1 addition & 1 deletion docs/comparison-with-other-frameworks.md
Original file line number Diff line number Diff line change
Expand Up @@ -70,5 +70,5 @@ To do. Feel free to open an issue to share your experience!

- Foal is written in TypeScript and Adonis in JavaScript.
- The architecture is pretty different: Adonis defines its routes with functions whereas Foal uses classes and decorators.
- Adonis has its own ORM: [Lucid](https://adonisjs.com/docs/4.0/lucid). Foal uses [TypeORM](http://typeorm.io) or [Mongoose](https://mongoosejs.com/).
- Adonis has its own ORM: [Lucid](https://adonisjs.com/docs/4.0/lucid). Foal uses [TypeORM](http://typeorm.io).
- Foal supports OpenAPI, Swagger UI and GraphQL.
10 changes: 1 addition & 9 deletions docs/development-environment/code-generation.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ foal createapp my-app

Create a new directory with all the required files to get started.

If you specify the flag `--mongodb`, the new project will use `mongoose` and `@foal/mongoose` in place of `typeorm` and `@foal/typeorm`. You can find more information [here](../databases/using-mongoose.md).
If you specify the flag `--mongodb`, the CLI will generate a new project using MongoDB instead of SQLite.

If you specify the flag `--yaml`, the new project will use YAML format for its configuration files. You can find more information [here](../deployment-and-environments/configuration.md).

Expand Down Expand Up @@ -91,14 +91,6 @@ foal g entity <name>

Create a new entity in `./src/app/entities`, in `./entities` or in the current directory depending on which folders are found.

## Create a model (only for Mongoose)

```shell
foal g model <name>
```

Create a new model in `./src/app/models`, in `./models` or in the current directory depending on which folders are found.

## Create REST API

```shell
Expand Down
2 changes: 1 addition & 1 deletion e2e_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ pm2 delete index
foal run create-user

#################################################################
# Repeat (almost) the same tests with a Mongoose and YAML project
# Repeat (almost) the same tests with a MongoDB and YAML project
#################################################################

cd ..
Expand Down
3 changes: 1 addition & 2 deletions packages/cli/src/generate/generators/app/create-app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -156,8 +156,7 @@ export async function createApp({ name, autoInstall, initRepo, mongodb = false,
log('');
log(' 📦 Installing the dependencies...');
const packageManager = isYarnInstalled() ? 'yarn' : 'npm';
// TODO: in version 2, remove the hack "--ignore-engines"
const args = [ 'install', '--ignore-engines' ];
const args = [ 'install' ];
const options: SpawnOptions = {
cwd: names.kebabName,
shell: true,
Expand Down

0 comments on commit 5ff8daa

Please sign in to comment.