Compare commits
10 Commits
1ffe22be10
...
ad11b7abec
Author | SHA1 | Date | |
---|---|---|---|
|
ad11b7abec | ||
|
5d33c006a2 | ||
|
2112a60001 | ||
|
7b9affcb8f | ||
|
44d80187c6 | ||
|
fd621ca5ae | ||
|
8e46d02ed1 | ||
|
29d8045f57 | ||
|
403223214f | ||
|
bbcefa9097 |
6
.gitignore
vendored
6
.gitignore
vendored
|
@ -9,4 +9,8 @@ tmp
|
|||
.env
|
||||
|
||||
# The development sqlite file
|
||||
database/development.sqlite
|
||||
database/*.sqlite
|
||||
|
||||
# VSCode & Webstorm history directories
|
||||
.history
|
||||
.idea
|
||||
|
|
17
app/Middleware/ConvertEmptyStringsToNull.js
Normal file
17
app/Middleware/ConvertEmptyStringsToNull.js
Normal file
|
@ -0,0 +1,17 @@
|
|||
'use strict'
|
||||
|
||||
class ConvertEmptyStringsToNull {
|
||||
async handle ({ request }, next) {
|
||||
if (Object.keys(request.body).length) {
|
||||
request.body = Object.assign(
|
||||
...Object.keys(request.body).map(key => ({
|
||||
[key]: request.body[key] !== '' ? request.body[key] : null
|
||||
}))
|
||||
)
|
||||
}
|
||||
|
||||
await next()
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = ConvertEmptyStringsToNull
|
16
app/Models/Traits/NoTimestamp.js
Normal file
16
app/Models/Traits/NoTimestamp.js
Normal file
|
@ -0,0 +1,16 @@
|
|||
'use strict'
|
||||
|
||||
class NoTimestamp {
|
||||
register (Model) {
|
||||
Object.defineProperties(Model, {
|
||||
createdAtColumn: {
|
||||
get: () => null,
|
||||
},
|
||||
updatedAtColumn: {
|
||||
get: () => null,
|
||||
},
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = NoTimestamp
|
|
@ -10,7 +10,7 @@ module.exports = {
|
|||
| Application Name
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| This value is the name of your application and can used when you
|
||||
| This value is the name of your application and can be used when you
|
||||
| need to place the application's name in a email, view or
|
||||
| other location.
|
||||
|
|
||||
|
@ -35,7 +35,7 @@ module.exports = {
|
|||
| Allow Method Spoofing
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Method spoofing allows to make requests by spoofing the http verb.
|
||||
| Method spoofing allows you to make requests by spoofing the http verb.
|
||||
| Which means you can make a GET request but instruct the server to
|
||||
| treat as a POST or PUT request. If you want this feature, set the
|
||||
| below value to true.
|
||||
|
@ -48,10 +48,10 @@ module.exports = {
|
|||
| Trust Proxy
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Trust proxy defines whether X-Forwaded-* headers should be trusted or not.
|
||||
| Trust proxy defines whether X-Forwarded-* headers should be trusted or not.
|
||||
| When your application is behind a proxy server like nginx, these values
|
||||
| are set automatically and should be trusted. Apart from setting it
|
||||
| to true or false Adonis supports handful or ways to allow proxy
|
||||
| to true or false Adonis supports a handful of ways to allow proxy
|
||||
| values. Read documentation for that.
|
||||
|
|
||||
*/
|
||||
|
@ -62,7 +62,7 @@ module.exports = {
|
|||
| Subdomains
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Offset to be used for returning subdomains for a given request.For
|
||||
| Offset to be used for returning subdomains for a given request. For
|
||||
| majority of applications it will be 2, until you have nested
|
||||
| sudomains.
|
||||
| cheatsheet.adonisjs.com - offset - 2
|
||||
|
@ -88,7 +88,7 @@ module.exports = {
|
|||
| Etag
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Set etag on all HTTP response. In order to disable for selected routes,
|
||||
| Set etag on all HTTP responses. In order to disable for selected routes,
|
||||
| you can call the `response.send` with an options object as follows.
|
||||
|
|
||||
| response.send('Hello', { ignoreEtag: true })
|
||||
|
@ -116,9 +116,9 @@ module.exports = {
|
|||
| Dot Files
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Define how to treat dot files when trying to server static resources.
|
||||
| Define how to treat dot files when trying to serve static resources.
|
||||
| By default it is set to ignore, which will pretend that dotfiles
|
||||
| does not exists.
|
||||
| do not exist.
|
||||
|
|
||||
| Can be one of the following
|
||||
| ignore, deny, allow
|
||||
|
|
|
@ -91,5 +91,11 @@ module.exports = {
|
|||
| the redis file. But you are free to define an object here too.
|
||||
|
|
||||
*/
|
||||
redis: 'self::redis.local'
|
||||
redis: {
|
||||
host: '127.0.0.1',
|
||||
port: 6379,
|
||||
password: null,
|
||||
db: 0,
|
||||
keyPrefix: ''
|
||||
}
|
||||
}
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
"dependencies": {
|
||||
"@adonisjs/ace": "^5.0.8",
|
||||
"@adonisjs/auth": "^3.0.7",
|
||||
"@adonisjs/bodyparser": "^2.0.5",
|
||||
"@adonisjs/bodyparser": "~2.0.9",
|
||||
"@adonisjs/cors": "^1.0.7",
|
||||
"@adonisjs/fold": "^4.0.9",
|
||||
"@adonisjs/framework": "^5.0.9",
|
||||
|
|
|
@ -67,6 +67,16 @@ section:before {
|
|||
animation: slideUp 1s cubic-bezier(0.19, 1, 0.30, 1) 0.5s forwards;
|
||||
}
|
||||
|
||||
|
||||
a {
|
||||
color: inherit;
|
||||
text-decoration: underline;
|
||||
}
|
||||
|
||||
p {
|
||||
margin: 0.83rem 0;
|
||||
}
|
||||
|
||||
@keyframes slideUp {
|
||||
0% {
|
||||
transform: translateY(40px);
|
||||
|
|
|
@ -9,7 +9,12 @@
|
|||
<section>
|
||||
<div class="logo"></div>
|
||||
<div class="title"></div>
|
||||
<div class="subtitle"><p>AdonisJs simplicity will make you feel confident about your code</p></div>
|
||||
<div class="subtitle">
|
||||
<p>AdonisJs simplicity will make you feel confident about your code</p>
|
||||
<p>
|
||||
Don't know where to start? Read the <a href="https://adonisjs.com/docs">documentation</a>.
|
||||
</p>
|
||||
</div>
|
||||
</section>
|
||||
</body>
|
||||
</html>
|
||||
|
|
|
@ -16,7 +16,8 @@ const globalMiddleware = [
|
|||
'Adonis/Middleware/BodyParser',
|
||||
'Adonis/Middleware/Session',
|
||||
'Adonis/Middleware/Shield',
|
||||
'Adonis/Middleware/AuthInit'
|
||||
'Adonis/Middleware/AuthInit',
|
||||
'App/Middleware/ConvertEmptyStringsToNull',
|
||||
]
|
||||
|
||||
/*
|
||||
|
@ -37,7 +38,8 @@ const globalMiddleware = [
|
|||
|
|
||||
*/
|
||||
const namedMiddleware = {
|
||||
auth: 'Adonis/Middleware/Auth'
|
||||
auth: 'Adonis/Middleware/Auth',
|
||||
guest: 'Adonis/Middleware/AllowGuestOnly'
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
|
|
||||
*/
|
||||
|
||||
/** @type {typeof import('@adonisjs/framework/src/Route/Manager'} */
|
||||
/** @type {typeof import('@adonisjs/framework/src/Route/Manager')} */
|
||||
const Route = use('Route')
|
||||
|
||||
Route.on('/').render('welcome')
|
||||
|
|
Loading…
Reference in New Issue
Block a user