0% found this document useful (0 votes)
52 views5 pages

Index: © Christopher Pitt 2018 C. Pitt, The Definitive Guide To Adonisjs

This document provides an overview of the AdonisJs framework, including instructions for setting up projects, routing, middleware, controllers, models, authentication, and more. It also covers integrating AdonisJs with databases, React, Stripe, and other tools and technologies.

Uploaded by

Zidi Boy
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
52 views5 pages

Index: © Christopher Pitt 2018 C. Pitt, The Definitive Guide To Adonisjs

This document provides an overview of the AdonisJs framework, including instructions for setting up projects, routing, middleware, controllers, models, authentication, and more. It also covers integrating AdonisJs with databases, React, Stripe, and other tools and technologies.

Uploaded by

Zidi Boy
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 5

Index

A, B request methods, 169


Shield library, 168
Ace script, 8
AdonisJs
Ace script, 8
APP_KEY, 3
D
command-line tool, 3 Dashboard
controller, 7 creation, 147–148
Node.js HTTP script, 4–5 Customer model, 148–149
routes, 6 customerId, 164
SendReminder, 8–9 customer-related data, 150–151
start/app.js, 8 migrations creation, 153–154
Arrays, 71 order ID, 152
Auth middleware, 166 toJSON method, 150
Databases
customers
C add fields, 121–122
Callback Hell, 82 authenticating, 125–127
Cheerio, 43–44, 46 boot method, 125
Conditionals, 36 check credentials, 125
Controllers display error page, 115–116
creation, 91 models, 118, 120–121
move route handlers, 92, 94–95 profile’s products, 116–118
reuse code, 96–97 setter, 123–124
Cooperative routine, see Coroutines hashed customer passwords, 171
Coroutines, 81, 84–85 lucid
CORS requests, 238–239, 241, 243 configuration file, 104
Cross-site request forgery (CSRF) .gitignore file, 106–107
add hidden field, 170–171 SQLite, 106
global middleware array, 168 migration
HttpException error, 169 add string columns, 109

245
© Christopher Pitt 2018
C. Pitt, The Definitive Guide to AdonisJs, https://doi.org/10.1007/978-1-4842-3390-0
Index

Databases (cont.) Edit Environment, 218


create empty, 108 install NPM dependencies, 218
database lookup, 110 Nginx configuration, 220–221
Database.raw, 110 SSL certificate, 221–222
seeding Front-end build tools
create empty, 111 Mix (see Mix)
create migrations for customers React, 179–181
and products, 112–113 Sass, 177–178
profile pages, 113
test data, 114–115
DigitalOcean G
create @ record, 216 Generators, cooperative
Forge (see Forge) multitasking, 75–77, 79
Namecheap, 211, 213, 215
sign up, 208
virtual servers, 208 H
HTTP, 11

E
E-mail, send I
adonis install command, 223 Interpolation, 35–36
config file, 223, 225 Iterators
password-reset request, 225, 227–228 class, 74
Error pages, 140, 142, 144 requests code, 72
Events, 81–82
Exceptions, 144–145
J, K
JSON responses, 62–63
F
Forge
add domain name, 213–214 L
add new daemon, 219 Layouts
add port, 218 add markup, 30–31
create account, 209 Bootstrap markup, 31–32
Deploy Script, 217 create new, 29
DigitalOcean create register view, 33
create new server, 210 Edge global functions and relative
linking, 209 protocols, 32
246
Index

Life-cycle methods, 190 Node.js


Loops, 37 HTTP server, 4
Lucid web site, 1–2
database configuration file, 104
.gitignore file, 106–107
SQLite, 106 P, Q
Partials, 38
Password-reset request
M
add customers’ migration
Macros, 66, 68–69
file, 225
Middleware
e-mail link, 228–229
auth, 166
e-mail template, 228
currency format, 100–101
route function, 228
add CurrencySelector to kernel.js, 98
sending email, 225, 227
Customer property, 165
Profile routes, 14–15
find location of user, 98
Promises
instructions for registering, 98
coroutines, 84–85
Mix
database code, 88
Babel, 176
Node.js, 86–87
configuration, 174
understanding, 83
JavaScript file, 176
NPM scripts, 174
PHP tools, 173 R
webpack, 174
React
Mocha framework
update .babelrc, 180
duplicate tests, 18–19
render method, 181
form, 20
shopping cart
install, 16
CartTotal component, 193
multiple parameters, 24–25
life-cycle methods, 190
NPM test script, 19
props object, 192
parameters, 20, 22
render process, 193, 197
run tests with, 25
total and proceed to payment
test file, 16
components, 191
Requests
N, O body parser
Namecheap library, 47
DNS Cheerio, 43–44, 46
server configuration, 215 class, 51

247
Index

Requests (cont.) Sessions


config files, 55 create user session, 155
content-type and language, 50 dashboard
cookies, 50 create, 147–148
DELETE, 52 create action, 156, 158
GET, 51, 54 create migrations, 153–154
headers, 50 Customer model, 148–149
helper functions, 41–42, 44, 46 customer-related data, 150–151
input method, 49 order ID, 152
markup, 46 route, 156
module.exports, 42 toJSON method, 150
npm run test, 41 modifying customer
PATCH, 52–53 controller, 161
POST, 52, 54 seeder class, 158
PUT, 52 ValidationException, 155–156
Responses Shopping cart
attachments, 66 Buy Now button and
cookies, 64 container, 187–188, 197
JSON, 62–63 create new orders, 201–202, 204–205
macros, 66, 68–69 dashboard data, 188–189
object, 61–62 data attributes, 198–199
redirect users, 64–65 onBuy method, 200–201
Routes profile template, 198
customer, 12–13 React
HTTP, 11 CartTotal component, 193
Mocha framework (see Mocha) life-cycle methods, 190
profile, 14–15 props object, 192
render process, 193, 197
total and proceed to payment
S components, 191
Sass, 177–178 SSL certificate, 221–222
Seeding Stripe
create empty, 111 create new account, 230
create migrations for customers and .env file, 230–231
products, 112–113 event handler, 237
profile pages, 113 JS SDK, 234
test data, 114–115 tokens, 231, 233–235, 237

248
Index

T, U fails method, 133


installation, 129
Template file
modify customer controller, 135
creation, 27–28
old method, 134
syntax
registration form, 137
conditionals, 36
registration page, 136
functions, 39
session library, 134
interpolation, 35–36
validateAll method, 133
loops, 37
partials, 38
yield, 38–39 W, X, Y, Z
ViewProvider, 28–29 WebSockets
Time to live (TTL), 216 shopping cart (see Shopping cart)
Socket.io, install
app.js, 185
V browser disconnects/sends
Validation message, 186
controller, 129–130 global function, 185
create rule, 131–132 hooks file, 184
display errors, 134 layout template, 185
error messages, 138–140 Node.js HTTP server, 183–184
exists rules, 132 shopping cart, 187–188

249

You might also like