Replies: 2 comments 6 replies
-
You have to compile your code to use it. |
Beta Was this translation helpful? Give feedback.
6 replies
-
Error resolvido |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
this error appears in my pod log: SyntaxError:
Cannot
use
import
statement
outside
a
module
at (syntax error) /home/node/app/config/app.ts:8
3| *
4| * Feel free to let us know via PR, if you find something broken in this config
5| * file.
6| /
7|
❯ 8| import proxyAddr from 'proxy-addr'
9| import Env from '@IOC:Adonis/Core/Env'
10| import type { ServerConfig } from '@IOC:Adonis/Core/Server'
11| import type { LoggerConfig } from '@IOC:Adonis/Core/Logger'
12| import type { ProfilerConfig } from '@IOC:Adonis/Core/Profiler'
13| // import type { ValidatorConfig } from '@IOC:Adonis/Core/Validator'
14|
15| /
16| |--------------------------------------------------------------------------
17| | Application secret key
18| |--------------------------------------------------------------------------
19| |
20| | The secret to encrypt and sign different values in your application.
21| | Make sure to keep the
APP_KEY
as an environment variable and secure.22| |
23| | Note: Changing the application key for an existing app will make all
24| | the cookies invalid and also the existing encrypted data will not
25| | be decrypted.
26| |
27| /
28| export const appKey: string = Env.get('APP_KEY')
29|
30| /
31| |--------------------------------------------------------------------------
32| | Http server configuration
33| |--------------------------------------------------------------------------
34| |
35| | The configuration for the HTTP(s) server. Make sure to go through all
36| | the config properties to make keep server secure.
37| |
38| /
39| export const http: ServerConfig = {
40| /
41| |--------------------------------------------------------------------------
42| | Allow method spoofing
43| |--------------------------------------------------------------------------
44| |
45| | Method spoofing enables defining custom HTTP methods using a query string
46| |
_method
. This is usually required when you are making traditional47| | form requests and wants to use HTTP verbs like
PUT
,DELETE
and48| | so on.
49| |
50| /
51| allowMethodSpoofing: false,
52|
53| /
54| |--------------------------------------------------------------------------
55| | Subdomain offset
56| |--------------------------------------------------------------------------
57| /
58| subdomainOffset: 2,
59|
60| /
61| |--------------------------------------------------------------------------
62| | Request Ids
63| |--------------------------------------------------------------------------
64| |
65| | Setting this value to
true
will generate a unique request id for each66| | HTTP request and set it as
x-request-id
header.67| |
68| /
69| generateRequestId: false,
70|
71| /
72| |--------------------------------------------------------------------------
73| | Trusting proxy servers
74| |--------------------------------------------------------------------------
75| |
76| | Define the proxy servers that AdonisJs must trust for reading
X-Forwarded
77| | headers.
78| |
79| /
80| trustProxy: proxyAddr.compile('loopback'),
81|
82| /
83| |--------------------------------------------------------------------------
84| | Generating Etag
85| |--------------------------------------------------------------------------
⁃ anonymous
/home/node/app/node_modules/require-all/index.js:56. how to solve this adonisjs syntax problem? my app.ts: /**
*/
import proxyAddr from 'proxy-addr'
import Env from '@IOC:Adonis/Core/Env'
import type { ServerConfig } from '@IOC:Adonis/Core/Server'
import type { LoggerConfig } from '@IOC:Adonis/Core/Logger'
import type { ProfilerConfig } from '@IOC:Adonis/Core/Profiler'
import type { ValidatorConfig } from '@IOC:Adonis/Core/Validator'
|
| The secret to encrypt and sign different values in your application.
| Make sure to keep the
APP_KEY
as an environment variable and secure.|
| Note: Changing the application key for an existing app will make all
| the cookies invalid and also the existing encrypted data will not
| be decrypted.
|
*/
export const appKey: string = Env.get('APP_KEY')
|
| The configuration for the HTTP(s) server. Make sure to go through all
| the config properties to make keep server secure.
|
*/
export const http: ServerConfig = {
|
| Method spoofing enables defining custom HTTP methods using a query string
|
_method
. This is usually required when you are making traditional| form requests and wants to use HTTP verbs like
PUT
,DELETE
and| so on.
|
*/
allowMethodSpoofing: false,
|
| Setting this value to
true
will generate a unique request id for each| HTTP request and set it as
x-request-id
header.|
*/
generateRequestId: false,
|
| Define the proxy servers that AdonisJs must trust for reading
X-Forwarded
| headers.
|
*/
trustProxy: proxyAddr.compile('loopback'),
|
| Whether or not to generate an etag for every response.
|
*/
etag: false,
},
|
| The internals of the framework relies on the content negotiation to
| detect the best possible response type for a given HTTP request.
|
| However, it is a very common these days that API servers always wants to
| make response in JSON regardless of the existence of the
Accept
header.|
| By setting
forceContentNegotiationTo = 'application/json'
, you negotiate| with the server in advance to always return JSON without relying on the
| client to set the header explicitly.
|
*/
forceContentNegotiationTo: 'application/json',
}
|
| The name of the application you want to add to the log. It is recommended
| to always have app name in every log line.
|
| The
APP_NAME
environment variable is automatically set by AdonisJS by| reading the
name
property from thepackage.json
file.|
*/
name: Env.get('APP_NAME'),
|
| Enable or disable logger application wide
|
*/
enabled: true,
|
| The level from which you want the logger to flush logs. It is recommended
| to make use of the environment variable, so that you can define log levels
| at deployment level and not code level.
|
*/
level: Env.get('LOG_LEVEL', 'info'),
|
| It is highly advised NOT to use
prettyPrint
in production, since it| can have huge impact on performance.
|
*/
prettyPrint: Env.get('NODE_ENV') === 'development',
}
|
| Enable or disable profiler
|
*/
enabled: true,
|
| Define an array of actions or row labels that you want to disable from
| getting profiled.
|
*/
blacklist: [],
|
| Define an array of actions or row labels that you want to whitelist for
| the profiler. When whitelist is defined, then
blacklist
is ignored.|
*/
whitelist: [],
}
|
| Configure the global configuration for the validator. Here's the reference
| to the default config https://git.io/JT0WE
|
*/
export const validator: ValidatorConfig = {}
ks8: apiVersion: v1
kind: Service
metadata:
name: adonis-kub-projeto
spec:
type: NodePort
selector:
app: adonis-kub-projeto
ports:
- port: 8080
targetPort: 80. apiVersion: apps/v1
kind: Deployment
metadata:
name: adonis-kub-projeto
namespace: default
spec:
replicas: 1
selector:
matchLabels:
app: adonis-kub-projeto
template:
metadata:
labels:
app: adonis-kub-projeto
spec:
containers:
- name: adonis-kub-projeto
image: joaoof/adonis-kub-projeto:latest
ports:
- containerPort: 80
env:
- name: PORT
value: "3001"
- name: HOST
value: "0.0.0.0"
- name: NODE_ENV
value: "development"
- name: APP_KEY
value: "zmySFzSMOgVl-c91euBqzLjYb0EheK6z"
- name: DRIVE_DISK
value: "local"
- name: CACHE_VIEWS
value: "false"
- name: SMTP_HOST
value: "sandbox.smtp.mailtrap.io"
- name: SMTP_PORT
value: "587"
- name: SMTP_USERNAME
value: "4cd40d834b414c"
- name: SMTP_PASSWORD
value: "a96f084db232e7"
- name: DB_CONNECTION
value: "pg"
- name: PG_HOST
value: "localhost"
- name: PG_PORT
value: "5432"
- name: PG_USER
value: "bhayron"
- name: PG_PASSWORD
value: "secret123"
- name: PG_DB_NAME
value: "sistema"
Beta Was this translation helpful? Give feedback.
All reactions