Skip to content

Commit 75de4b3

Browse files
committedJun 29, 2024
Initial commit
0 parents  commit 75de4b3

33 files changed

+6854
-0
lines changed
 

‎.adonisrc.json

+41
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
{
2+
"typescript": true,
3+
"commands": [
4+
"./commands",
5+
"@adonisjs/core/build/commands/index.js",
6+
"@adonisjs/repl/build/commands"
7+
],
8+
"exceptionHandlerNamespace": "App/Exceptions/Handler",
9+
"aliases": {
10+
"App": "app",
11+
"Config": "config",
12+
"Database": "database",
13+
"Contracts": "contracts"
14+
},
15+
"preloads": [
16+
"./start/routes",
17+
"./start/kernel"
18+
],
19+
"providers": [
20+
"./providers/AppProvider",
21+
"@adonisjs/core",
22+
"@adonisjs/ally"
23+
],
24+
"aceProviders": [
25+
"@adonisjs/repl"
26+
],
27+
"tests": {
28+
"suites": [
29+
{
30+
"name": "functional",
31+
"files": [
32+
"tests/functional/**/*.spec(.ts|.js)"
33+
],
34+
"timeout": 60000
35+
}
36+
]
37+
},
38+
"testProviders": [
39+
"@japa/preset-adonis/TestsProvider"
40+
]
41+
}

‎.editorconfig

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
root = true
2+
3+
[*]
4+
indent_style = space
5+
indent_size = 2
6+
end_of_line = lf
7+
charset = utf-8
8+
trim_trailing_whitespace = true
9+
insert_final_newline = true
10+
11+
[*.json]
12+
insert_final_newline = false
13+
14+
[*.md]
15+
trim_trailing_whitespace = false

‎.env.example

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
PORT=3333
2+
HOST=0.0.0.0
3+
NODE_ENV=development
4+
APP_KEY=RiXZJiAizRz3esHKRLBRdTDCWV-REM7u
5+
DRIVE_DISK=local
6+
TWITTER_CLIENT_ID=clientId
7+
TWITTER_CLIENT_SECRET=clientSecret

‎.env.test

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
NODE_ENV=test

‎.gitignore

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
node_modules
2+
build
3+
coverage
4+
.vscode
5+
.DS_STORE
6+
.env
7+
tmp
8+
npm-debug.log*
9+
yarn-debug.log*
10+
yarn-error.log*
11+
lerna-debug.log*
12+
.pnpm-debug.log*
13+
logs
14+
*.log
15+
.yarn/cache
16+
.yarn/unplugged
17+
.yarn/build-state.yml
18+
.yarn/install-state.gz
19+
.pnp.*
20+
.yarn-integrity

‎.prettierignore

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
build

‎ace

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
/*
2+
|--------------------------------------------------------------------------
3+
| Ace Commands
4+
|--------------------------------------------------------------------------
5+
|
6+
| This file is the entry point for running ace commands.
7+
|
8+
*/
9+
10+
require('reflect-metadata')
11+
require('source-map-support').install({ handleUncaughtExceptions: false })
12+
13+
const { Ignitor } = require('@adonisjs/core/build/standalone')
14+
new Ignitor(__dirname)
15+
.ace()
16+
.handle(process.argv.slice(2))

‎ace-manifest.json

+101
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,101 @@
1+
{
2+
"commands": {
3+
"dump:rcfile": {
4+
"settings": {},
5+
"commandPath": "@adonisjs/core/build/commands/DumpRc",
6+
"commandName": "dump:rcfile",
7+
"description": "Dump contents of .adonisrc.json file along with defaults",
8+
"args": [],
9+
"aliases": [],
10+
"flags": []
11+
},
12+
"list:routes": {
13+
"settings": {
14+
"loadApp": true,
15+
"stayAlive": true
16+
},
17+
"commandPath": "@adonisjs/core/build/commands/ListRoutes/index",
18+
"commandName": "list:routes",
19+
"description": "List application routes",
20+
"args": [],
21+
"aliases": [],
22+
"flags": [
23+
{
24+
"name": "verbose",
25+
"propertyName": "verbose",
26+
"type": "boolean",
27+
"description": "Display more information"
28+
},
29+
{
30+
"name": "reverse",
31+
"propertyName": "reverse",
32+
"type": "boolean",
33+
"alias": "r",
34+
"description": "Reverse routes display"
35+
},
36+
{
37+
"name": "methods",
38+
"propertyName": "methodsFilter",
39+
"type": "array",
40+
"alias": "m",
41+
"description": "Filter routes by method"
42+
},
43+
{
44+
"name": "patterns",
45+
"propertyName": "patternsFilter",
46+
"type": "array",
47+
"alias": "p",
48+
"description": "Filter routes by the route pattern"
49+
},
50+
{
51+
"name": "names",
52+
"propertyName": "namesFilter",
53+
"type": "array",
54+
"alias": "n",
55+
"description": "Filter routes by route name"
56+
},
57+
{
58+
"name": "json",
59+
"propertyName": "json",
60+
"type": "boolean",
61+
"description": "Output as JSON"
62+
},
63+
{
64+
"name": "table",
65+
"propertyName": "table",
66+
"type": "boolean",
67+
"description": "Output as Table"
68+
},
69+
{
70+
"name": "max-width",
71+
"propertyName": "maxWidth",
72+
"type": "number",
73+
"description": "Specify maximum rendering width. Ignored for JSON Output"
74+
}
75+
]
76+
},
77+
"generate:key": {
78+
"settings": {},
79+
"commandPath": "@adonisjs/core/build/commands/GenerateKey",
80+
"commandName": "generate:key",
81+
"description": "Generate a new APP_KEY secret",
82+
"args": [],
83+
"aliases": [],
84+
"flags": []
85+
},
86+
"repl": {
87+
"settings": {
88+
"loadApp": true,
89+
"environment": "repl",
90+
"stayAlive": true
91+
},
92+
"commandPath": "@adonisjs/repl/build/commands/AdonisRepl",
93+
"commandName": "repl",
94+
"description": "Start a new REPL session",
95+
"args": [],
96+
"aliases": [],
97+
"flags": []
98+
}
99+
},
100+
"aliases": {}
101+
}

‎app/Exceptions/Handler.ts

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
/*
2+
|--------------------------------------------------------------------------
3+
| Http Exception Handler
4+
|--------------------------------------------------------------------------
5+
|
6+
| AdonisJs will forward all exceptions occurred during an HTTP request to
7+
| the following class. You can learn more about exception handling by
8+
| reading docs.
9+
|
10+
| The exception handler extends a base `HttpExceptionHandler` which is not
11+
| mandatory, however it can do lot of heavy lifting to handle the errors
12+
| properly.
13+
|
14+
*/
15+
16+
import Logger from '@ioc:Adonis/Core/Logger'
17+
import HttpExceptionHandler from '@ioc:Adonis/Core/HttpExceptionHandler'
18+
19+
export default class ExceptionHandler extends HttpExceptionHandler {
20+
constructor() {
21+
super(Logger)
22+
}
23+
}

‎commands/index.ts

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
import { listDirectoryFiles } from '@adonisjs/core/build/standalone'
2+
import Application from '@ioc:Adonis/Core/Application'
3+
4+
/*
5+
|--------------------------------------------------------------------------
6+
| Exporting an array of commands
7+
|--------------------------------------------------------------------------
8+
|
9+
| Instead of manually exporting each file from this directory, we use the
10+
| helper `listDirectoryFiles` to recursively collect and export an array
11+
| of filenames.
12+
|
13+
| Couple of things to note:
14+
|
15+
| 1. The file path must be relative from the project root and not this directory.
16+
| 2. We must ignore this file to avoid getting into an infinite loop
17+
|
18+
*/
19+
export default listDirectoryFiles(__dirname, Application.appRoot, ['./commands/index'])

‎config/ally.ts

+34
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
/**
2+
* Config source: https://git.io/JOdi5
3+
*
4+
* Feel free to let us know via PR, if you find something broken in this config
5+
* file.
6+
*/
7+
8+
import Env from '@ioc:Adonis/Core/Env'
9+
import { AllyConfig } from '@ioc:Adonis/Addons/Ally'
10+
11+
/*
12+
|--------------------------------------------------------------------------
13+
| Ally Config
14+
|--------------------------------------------------------------------------
15+
|
16+
| The `AllyConfig` relies on the `SocialProviders` interface which is
17+
| defined inside `contracts/ally.ts` file.
18+
|
19+
*/
20+
const allyConfig: AllyConfig = {
21+
/*
22+
|--------------------------------------------------------------------------
23+
| Twitter driver
24+
|--------------------------------------------------------------------------
25+
*/
26+
twitter: {
27+
driver: 'twitter',
28+
clientId: Env.get('TWITTER_CLIENT_ID'),
29+
clientSecret: Env.get('TWITTER_CLIENT_SECRET'),
30+
callbackUrl: 'http://localhost:3333/twitter/callback',
31+
},
32+
}
33+
34+
export default allyConfig

0 commit comments

Comments
 (0)
Please sign in to comment.