- Architecture
- Create a top level
index.ts
file for entry point - Create a top level
deps.ts
file for dependencies and use this file to generate a lock file - Every data object has its own folder
repository
folder for in memory or databasecontroller.ts
for main operationsindex.ts
for exportexport type MyType = ... export interface MyInterface = { myfunction: (arg types) => output types ... }
types.ts
for types needed around the module
- Create a folder
web
for the API routes - Create a folder
config
for the file configuration- Uses a YAML file in the top level to specify visible config
- Uses environmental variables to set secret config
- Create a top level
- Code notes
- Use
Pick<Class, "member1" | "member2">
andOmit<Class, "member3">
to create classes that are subsets
- Use
- Lock files: will check a downloaded packages integrity
- Creating a lock file
deno cache --lock=lock.json --lock-write src/deps.ts
- Using the lock file
deno cache --lock=lock.json src/deps.ts
- Add a dependency, reload the cache
deno cache --lock=lock.json --reload --lock-write src/deps.ts
- Creating a lock file
- Curl
- Example commands
curl -X POST -d '{"username": "audrow", "password": "testpw" }' -H 'Content-Type: application/json' http://localhost:8080/api/users/register
curl -X POST -d '{"username": "audrow", "password": "testpw" }' -H 'Content-Type: application/json' http://localhost:8080/api/login
- Example commands
- JSON Web Tokens (JWT) a way of keeping users in by giving them a temporary token to confirm that they are logged in
- Benchmarking
- Use the bench command and run it
- Use high resolution time to make it more accurate
deno run --allow-hrtime --unstable src/users/utilBenchMarks.ts
Created
December 16, 2021 15:24
-
-
Save audrow/96db8f3ce54a1ce3691f03837648ee93 to your computer and use it in GitHub Desktop.
Deno Web Development by Alexandre Portela Notes #book #webdev
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment