This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const int smokeSensorPin = A0; | |
const int buzzerPin = 9; | |
const int currentLevel = 0; | |
void setup() { | |
Serial.println("Running ..."); | |
pinMode(buzzerPin, OUTPUT); | |
pinMode(smokeSensorPin, INPUT); | |
Serial.begin(9600); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { GuardsList } from '@ioc:Adonis/Addons/Auth' | |
import { HttpContextContract } from '@ioc:Adonis/Core/HttpContext' | |
import AuthException from 'App/Exceptions/AuthException' | |
/** | |
* Auth middleware is meant to restrict un-authenticated access to a given route | |
* or a group of routes. | |
* | |
* You must register this middleware inside `start/kernel.ts` file under the list | |
* of named middleware. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { GuardsList } from '@ioc:Adonis/Addons/Auth' | |
import { HttpContextContract } from '@ioc:Adonis/Core/HttpContext' | |
import AuthException from 'App/Exceptions/AuthException' | |
/** | |
* Auth middleware is meant to restrict un-authenticated access to a given route | |
* or a group of routes. | |
* | |
* You must register this middleware inside `start/kernel.ts` file under the list | |
* of named middleware. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { GuardsList } from '@ioc:Adonis/Addons/Auth' | |
import { HttpContextContract } from '@ioc:Adonis/Core/HttpContext' | |
import AuthException from 'App/Exceptions/AuthException' | |
/** | |
* Auth middleware is meant to restrict un-authenticated access to a given route | |
* or a group of routes. | |
* | |
* You must register this middleware inside `start/kernel.ts` file under the list | |
* of named middleware. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module.exports = { | |
apps: [{ | |
name: 'app-name', | |
script: 'build/server.js', | |
autorestart: true, | |
watch: false, | |
max_memory_restart: '2G', | |
env_development: { | |
COMMON_VARIABLE: 'true', | |
PORT: 3000, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
server { | |
server_name <app-domain>; | |
access_log /var/log/nginx/<app-name>.access.log; | |
error_log /var/log/nginx/<app-name>.error.log; | |
location / { | |
include proxy_params; | |
proxy_pass http://0.0.0.0:<app-port>; | |
proxy_set_header Host $host; | |
proxy_set_header X-Forwared-Proto $scheme; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import type { HttpContextContract } from '@ioc:Adonis/Core/HttpContext' | |
import AuthException from 'App/Exceptions/AuthException' | |
import AccountService from 'App/Services/User/AccountService' | |
export default class Role { | |
service = new AccountService() | |
public async handle({ auth }: HttpContextContract, next: () => Promise<void>, rule) { | |
const roles = rule | |
if (roles.length == 0) { | |
await next() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CREATE USER <username> EITH ENCRYPTED PASSWORD '<password>'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
node ace make:module <Namespace> <ModelName> --endpoint <EndpointName> --soft-delete |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import type { HttpContextContract } from '@ioc:Adonis/Core/HttpContext' | |
import AuthException from 'App/Exceptions/AuthException' | |
import dbConfig from 'Config/database' | |
import Env from '@ioc:Adonis/Core/Env' | |
import Database from '@ioc:Adonis/Lucid/Database'; | |
export default class SwitchDatabase { | |
public async handle({ request }: HttpContextContract, next: () => Promise<void>) { | |
const storeCode = request.header('code-store'); |
OlderNewer