jwt-serverless-atuhentication

0.0.4 • Public • Published

angular-auth-api

Run develop

Requirements:

- node
- docker-compose

Steps:

1. npm i
2. npm run db:docker
3. npm run start:dev

DynamoDB local: http://localhost:8000

API endpoint: http://localhost:3000

Swagger (http://localhost:3001/api):

npm run swagger

Production

Requirements:

Start production offline: npm run sls:offline

Deploy:

1. npm i
2. aws configuration
3. edit config file (src/shared/config.index.ts)
4. npm run sls:deploy

Add more DB providers, for example MongoDB

1. Import MongooseModule into db.module.ts

@Module({
  ...
  imports: [
    ...
    MongooseModule.forRoot('mongodb://localhost/madocders'),
    ...
  ],
  ...
})

2. Create mongoose schema

export const userSchema = new mongoose.Schema({
  username: String,
  password: String,
  firstName: String,
  lastName: String,
  organization: String,
});

3. Import UserSchema into db module

@Module({
  ...
  imports: [
    ...
    MongooseModule.forRoot('mongodb://localhost/madocders'),
    MongooseModule.forFeature([{ name: 'User', schema: UserSchema }])
    ...
  ],
  ...
})

4. Inject UserModel into service

@InjectModel('User') private readonly userModel: Model<UserModel>

Docs

Process env config

JWT_SECRET
AWS_ACCESS_KEY
AWS_ACCESS_SECRET

Readme

Keywords

none

Package Sidebar

Install

npm i jwt-serverless-atuhentication

Weekly Downloads

0

Version

0.0.4

License

MIT

Unpacked Size

28.8 kB

Total Files

41

Last publish

Collaborators

  • madcoders