mirror of
https://github.com/rjNemo/deno_hello
synced 2026-06-06 01:56:40 +00:00
refactor: controllers
This commit is contained in:
parent
75448f34b0
commit
a25356dd68
22 changed files with 523 additions and 81 deletions
8
.idea/.gitignore
vendored
8
.idea/.gitignore
vendored
|
|
@ -1,8 +0,0 @@
|
|||
# Default ignored files
|
||||
/shelf/
|
||||
/workspace.xml
|
||||
# Datasource local storage ignored files
|
||||
/dataSources/
|
||||
/dataSources.local.xml
|
||||
# Editor-based HTTP Client requests
|
||||
/httpRequests/
|
||||
|
|
@ -1,5 +0,0 @@
|
|||
<component name="ProjectCodeStyleConfiguration">
|
||||
<state>
|
||||
<option name="PREFERRED_PROJECT_CODE_STYLE" value="Default" />
|
||||
</state>
|
||||
</component>
|
||||
|
|
@ -5,7 +5,4 @@
|
|||
<orderEntry type="inheritedJdk" />
|
||||
<orderEntry type="sourceFolder" forTests="false" />
|
||||
</component>
|
||||
<component name="TestRunnerService">
|
||||
<option name="PROJECT_TEST_RUNNER" value="pytest" />
|
||||
</component>
|
||||
</module>
|
||||
|
|
@ -2,6 +2,7 @@
|
|||
<profile version="1.0">
|
||||
<option name="myName" value="Project Default" />
|
||||
<inspection_tool class="Eslint" enabled="true" level="WARNING" enabled_by_default="true" />
|
||||
<inspection_tool class="JSXSyntaxUsed" enabled="true" level="ERROR" enabled_by_default="true" />
|
||||
<inspection_tool class="PyCompatibilityInspection" enabled="true" level="WARNING" enabled_by_default="true">
|
||||
<option name="ourVersions">
|
||||
<value>
|
||||
|
|
@ -12,5 +13,13 @@
|
|||
</value>
|
||||
</option>
|
||||
</inspection_tool>
|
||||
<inspection_tool class="PyUnresolvedReferencesInspection" enabled="true" level="WARNING" enabled_by_default="true">
|
||||
<option name="ignoredIdentifiers">
|
||||
<list>
|
||||
<option value="examples.work_queue.worker.sys" />
|
||||
<option value="examples.work_queue.worker.BlockingChannel" />
|
||||
</list>
|
||||
</option>
|
||||
</inspection_tool>
|
||||
</profile>
|
||||
</component>
|
||||
|
|
@ -7,7 +7,7 @@
|
|||
<option name="description" />
|
||||
<option name="exitCodeBehavior" value="ERROR" />
|
||||
<option name="fileExtension" value="ts" />
|
||||
<option name="immediateSync" value="false" />
|
||||
<option name="immediateSync" value="true" />
|
||||
<option name="name" value="deno" />
|
||||
<option name="output" value="" />
|
||||
<option name="outputFilters">
|
||||
|
|
@ -15,7 +15,7 @@
|
|||
</option>
|
||||
<option name="outputFromStdout" value="false" />
|
||||
<option name="program" value="deno" />
|
||||
<option name="runOnExternalChanges" value="false" />
|
||||
<option name="runOnExternalChanges" value="true" />
|
||||
<option name="scopeName" value="Project Files" />
|
||||
<option name="trackOnlyRoot" value="false" />
|
||||
<option name="workingDir" value="" />
|
||||
|
|
|
|||
130
.idea/workspace.xml
Normal file
130
.idea/workspace.xml
Normal file
|
|
@ -0,0 +1,130 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="AutoImportSettings">
|
||||
<option name="autoReloadType" value="SELECTIVE" />
|
||||
</component>
|
||||
<component name="ChangeListManager">
|
||||
<list default="true" id="d0c77201-663f-463b-b30b-fd433a557d2f" name="Changes" comment="">
|
||||
<change afterPath="$PROJECT_DIR$/src/main.ts" afterDir="false" />
|
||||
<change afterPath="$PROJECT_DIR$/src/routes.ts" afterDir="false" />
|
||||
<change afterPath="$PROJECT_DIR$/src/server.ts" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/.idea/.gitignore" beforeDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/.idea/codeStyles/codeStyleConfig.xml" beforeDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/.idea/hello-server.iml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/hello-server.iml" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/.idea/inspectionProfiles/Project_Default.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/inspectionProfiles/Project_Default.xml" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/.idea/watcherTasks.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/watcherTasks.xml" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/.vscode/settings.json" beforeDir="false" afterPath="$PROJECT_DIR$/.vscode/settings.json" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/Makefile" beforeDir="false" afterPath="$PROJECT_DIR$/Makefile" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/cli.ts" beforeDir="false" afterPath="$PROJECT_DIR$/src/cli.ts" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/deps.ts" beforeDir="false" afterPath="$PROJECT_DIR$/src/deps.ts" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/server.ts" beforeDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/index.ts" beforeDir="false" afterPath="$PROJECT_DIR$/src/mod.ts" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/repositories/locales.test.ts" beforeDir="false" afterPath="$PROJECT_DIR$/src/repositories/locales.test.ts" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/types/id.test.ts" beforeDir="false" afterPath="$PROJECT_DIR$/src/types/id.test.ts" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/usecases/hello.test.ts" beforeDir="false" afterPath="$PROJECT_DIR$/src/usecases/hello.test.ts" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/view.ts" beforeDir="false" afterPath="$PROJECT_DIR$/src/view.ts" afterDir="false" />
|
||||
</list>
|
||||
<option name="SHOW_DIALOG" value="false" />
|
||||
<option name="HIGHLIGHT_CONFLICTS" value="true" />
|
||||
<option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" />
|
||||
<option name="LAST_RESOLUTION" value="IGNORE" />
|
||||
</component>
|
||||
<component name="FileTemplateManagerImpl">
|
||||
<option name="RECENT_TEMPLATES">
|
||||
<list>
|
||||
<option value="TypeScript File" />
|
||||
</list>
|
||||
</option>
|
||||
</component>
|
||||
<component name="Git.Settings">
|
||||
<option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$" />
|
||||
</component>
|
||||
<component name="GitSEFilterConfiguration">
|
||||
<file-type-list>
|
||||
<filtered-out-file-type name="LOCAL_BRANCH" />
|
||||
<filtered-out-file-type name="REMOTE_BRANCH" />
|
||||
<filtered-out-file-type name="TAG" />
|
||||
<filtered-out-file-type name="COMMIT_BY_MESSAGE" />
|
||||
</file-type-list>
|
||||
</component>
|
||||
<component name="JsBowerSettings">
|
||||
<node-interpreter value="project" />
|
||||
<bower-package value="" />
|
||||
<bower.json value="" />
|
||||
</component>
|
||||
<component name="MacroExpansionManager">
|
||||
<option name="directoryName" value="1ijkcixt" />
|
||||
</component>
|
||||
<component name="ProjectId" id="1wuK4ScIDfOJC3IylLWxy9lgarf" />
|
||||
<component name="ProjectViewState">
|
||||
<option name="autoscrollFromSource" value="true" />
|
||||
<option name="autoscrollToSource" value="true" />
|
||||
<option name="hideEmptyMiddlePackages" value="true" />
|
||||
<option name="showLibraryContents" value="true" />
|
||||
</component>
|
||||
<component name="PropertiesComponent">
|
||||
<property name="NEW_TOOLWINDOW_STRIPE_DEFAULTS" value="true" />
|
||||
<property name="RunOnceActivity.OpenProjectViewOnStart" value="true" />
|
||||
<property name="RunOnceActivity.ShowReadmeOnStart" value="true" />
|
||||
<property name="WebServerToolWindowFactoryState" value="false" />
|
||||
<property name="node.js.detected.package.tslint" value="true" />
|
||||
<property name="node.js.path.for.package.eslint" value="project" />
|
||||
<property name="node.js.path.for.package.standard" value="project" />
|
||||
<property name="node.js.selected.package.eslint" value="(autodetect)" />
|
||||
<property name="node.js.selected.package.standard" value="" />
|
||||
<property name="node.js.selected.package.tslint" value="(autodetect)" />
|
||||
<property name="settings.editor.selected.configurable" value="watcher.settings" />
|
||||
<property name="ts.external.directory.path" value="$APPLICATION_HOME_DIR$/plugins/JavaScriptLanguage/jsLanguageServicesImpl/external" />
|
||||
</component>
|
||||
<component name="RecentsManager">
|
||||
<key name="es6.move.members.recent.items">
|
||||
<recent name="$PROJECT_DIR$/routes.ts" />
|
||||
</key>
|
||||
<key name="MoveFile.RECENT_KEYS">
|
||||
<recent name="$PROJECT_DIR$/src" />
|
||||
</key>
|
||||
</component>
|
||||
<component name="RunManager" selected="Deno.Deno: server.ts">
|
||||
<configuration name="Deno: server.ts" type="DenoConfigurationType" temporary="true" nameIsGenerated="true" inputPath="$PROJECT_DIR$/server.ts" programParameters="run" workingDirectory="$PROJECT_DIR$">
|
||||
<method v="2" />
|
||||
</configuration>
|
||||
<configuration name="test" type="MixRunConfigurationType" factoryName="Elixir Mix">
|
||||
<mix>
|
||||
<argument>test</argument>
|
||||
</mix>
|
||||
<module-filters inherit-application-module-filters="true" />
|
||||
<method v="2" />
|
||||
</configuration>
|
||||
<recent_temporary>
|
||||
<list>
|
||||
<item itemvalue="Deno.Deno: server.ts" />
|
||||
</list>
|
||||
</recent_temporary>
|
||||
</component>
|
||||
<component name="SpellCheckerSettings" RuntimeDictionaries="0" Folders="0" CustomDictionaries="0" DefaultDictionary="application-level" UseSingleDictionary="true" transferred="true" />
|
||||
<component name="TaskManager">
|
||||
<task active="true" id="Default" summary="Default task">
|
||||
<changelist id="d0c77201-663f-463b-b30b-fd433a557d2f" name="Changes" comment="" />
|
||||
<created>1629302841743</created>
|
||||
<option name="number" value="Default" />
|
||||
<option name="presentableId" value="Default" />
|
||||
<updated>1629302841743</updated>
|
||||
<workItem from="1629302843625" duration="5327000" />
|
||||
</task>
|
||||
<servers />
|
||||
</component>
|
||||
<component name="TypeScriptGeneratedFilesManager">
|
||||
<option name="version" value="3" />
|
||||
</component>
|
||||
<component name="Vcs.Log.Tabs.Properties">
|
||||
<option name="TAB_STATES">
|
||||
<map>
|
||||
<entry key="MAIN">
|
||||
<value>
|
||||
<State />
|
||||
</value>
|
||||
</entry>
|
||||
</map>
|
||||
</option>
|
||||
</component>
|
||||
</project>
|
||||
1
.vscode/configurationCache.log
vendored
Normal file
1
.vscode/configurationCache.log
vendored
Normal file
|
|
@ -0,0 +1 @@
|
|||
{"buildTargets":["cli","lint","run","tests"],"launchTargets":[],"customConfigurationProvider":{"workspaceBrowse":{"browsePath":[],"compilerArgs":[]},"fileIndex":[]}}
|
||||
5
.vscode/dryrun.log
vendored
Normal file
5
.vscode/dryrun.log
vendored
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
make -f "/Users/ruidy/Dev/_Perso/deno/hello-server/Makefile" --dry-run --always-make --keep-going --print-directory
|
||||
make: Entering directory `/Users/ruidy/Dev/_Perso/deno/hello-server'
|
||||
deno run cli.ts
|
||||
make: Leaving directory `/Users/ruidy/Dev/_Perso/deno/hello-server'
|
||||
|
||||
29
.vscode/settings.json
vendored
29
.vscode/settings.json
vendored
|
|
@ -1,14 +1,19 @@
|
|||
{
|
||||
"deno.enable": true,
|
||||
"deno.unstable": true,
|
||||
"deno.lint": true,
|
||||
"deno.import_intellisense_origins": {
|
||||
"https://deno.land": true
|
||||
},
|
||||
"[typescript]": {
|
||||
"editor.defaultFormatter": "denoland.vscode-deno"
|
||||
},
|
||||
"[typescriptreact]": {
|
||||
"editor.defaultFormatter": "denoland.vscode-deno"
|
||||
}
|
||||
"deno.enable": true,
|
||||
"deno.unstable": true,
|
||||
"deno.lint": true,
|
||||
"[typescript]": {
|
||||
"editor.defaultFormatter": "denoland.vscode-deno"
|
||||
},
|
||||
"[typescriptreact]": {
|
||||
"editor.defaultFormatter": "denoland.vscode-deno"
|
||||
},
|
||||
"files.eol": "\n",
|
||||
"files.trimTrailingWhitespace": true,
|
||||
"files.exclude": {
|
||||
"**/.git": true,
|
||||
"**/.DS_Store": true,
|
||||
"**/Thumbs.db": true,
|
||||
"**/.aleph": true
|
||||
}
|
||||
}
|
||||
|
|
|
|||
290
.vscode/targets.log
vendored
Normal file
290
.vscode/targets.log
vendored
Normal file
|
|
@ -0,0 +1,290 @@
|
|||
make all -f "/Users/ruidy/Dev/_Perso/deno/hello-server/Makefile" --print-data-base --no-builtin-variables --no-builtin-rules --question
|
||||
# GNU Make 3.81
|
||||
# Copyright (C) 2006 Free Software Foundation, Inc.
|
||||
# This is free software; see the source for copying conditions.
|
||||
# There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A
|
||||
# PARTICULAR PURPOSE.
|
||||
|
||||
# This program built for i386-apple-darwin11.3.0
|
||||
|
||||
# Make data base, printed on Sun Jun 27 15:52:43 2021
|
||||
|
||||
# Variables
|
||||
|
||||
# automatic
|
||||
<D = $(patsubst %/,%,$(dir $<))
|
||||
# automatic
|
||||
?F = $(notdir $?)
|
||||
# environment
|
||||
ELECTRON_NO_ATTACH_CONSOLE = 1
|
||||
# environment
|
||||
LC_CTYPE = UTF-8
|
||||
# environment
|
||||
VSCODE_LOG_NATIVE = false
|
||||
# automatic
|
||||
?D = $(patsubst %/,%,$(dir $?))
|
||||
# automatic
|
||||
@D = $(patsubst %/,%,$(dir $@))
|
||||
# automatic
|
||||
@F = $(notdir $@)
|
||||
# makefile
|
||||
CURDIR := /Users/ruidy/Dev/_Perso/deno/hello-server
|
||||
# makefile
|
||||
SHELL = /bin/sh
|
||||
# environment
|
||||
VSCODE_NLS_CONFIG = {"locale":"en-gb","availableLanguages":{},"_languagePackSupport":true}
|
||||
# environment
|
||||
_ = /usr/bin/make
|
||||
# makefile (from `/Users/ruidy/Dev/_Perso/deno/hello-server/Makefile', line 1)
|
||||
MAKEFILE_LIST := /Users/ruidy/Dev/_Perso/deno/hello-server/Makefile
|
||||
# environment
|
||||
VSCODE_NODE_CACHED_DATA_DIR = /Users/ruidy/Library/Application Support/Code/CachedData/507ce72a4466fbb27b715c3722558bb15afa9f48
|
||||
# environment
|
||||
VSCODE_VERBOSE_LOGGING = true
|
||||
# environment
|
||||
__CFBundleIdentifier = com.googlecode.iterm2
|
||||
# environment
|
||||
VSCODE_IPC_HOOK_EXTHOST = /var/folders/1r/l9hbvtfx3d945mtjwqyzhtj80000gn/T/vscode-ipc-979150f6-1588-46bf-8dce-e07e0d556b71.sock
|
||||
# environment
|
||||
VSCODE_CWD = /Users/ruidy/Dev/_Perso/deno
|
||||
# environment
|
||||
PATH = /Users/ruidy/.deno/bin:/usr/local/sbin:/Users/ruidy/.pyenv/shims:/Users/ruidy/.pyenv/bin:/Users/ruidy/.cabal/bin:/Users/ruidy/.ghcup/bin:/Users/ruidy/.cargo/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/go/bin:/Library/Apple/usr/bin:/Users/ruidy/Library/Android/sdk/emulator:/Users/ruidy/Library/Android/sdk/tools:/Users/ruidy/Library/Android/sdk/tools/bin:/Users/ruidy/Library/Android/sdk/platform-tools:/Users/ruidy/go/bin:/Users/ruidy/flutter/bin
|
||||
# environment
|
||||
LSCOLORS = Gxfxcxdxbxegedabagacad
|
||||
# environment
|
||||
SPACESHIP_VERSION = 3.11.2
|
||||
# environment
|
||||
LaunchInstanceID = 8ADEE964-5E57-4086-A826-A6BCC41D815B
|
||||
# environment
|
||||
VSCODE_LOG_STACK = false
|
||||
# environment
|
||||
ELECTRON_RUN_AS_NODE = 1
|
||||
# environment
|
||||
PYENV_ROOT = /Users/ruidy/.pyenv
|
||||
# environment
|
||||
ANDROID_HOME = /Users/ruidy/Library/Android/sdk
|
||||
# default
|
||||
.FEATURES := target-specific order-only second-expansion else-if archives jobserver check-symlink
|
||||
# environment
|
||||
SSH_AUTH_SOCK = /private/tmp/com.apple.launchd.4YfI6Pdv5d/Listeners
|
||||
# automatic
|
||||
%F = $(notdir $%)
|
||||
# environment
|
||||
VSCODE_PIPE_LOGGING = true
|
||||
# environment
|
||||
PWD = /Users/ruidy/Dev/_Perso/deno/hello-server
|
||||
# environment
|
||||
ORIGINAL_XDG_CURRENT_DESKTOP = undefined
|
||||
# environment
|
||||
VSCODE_AMD_ENTRYPOINT = vs/workbench/services/extensions/node/extensionHostProcess
|
||||
# environment
|
||||
HOME = /Users/ruidy
|
||||
# default
|
||||
MAKEFILEPATH := /Applications/Xcode.app/Contents/Developer/Makefiles
|
||||
# environment
|
||||
VSCODE_CLI = 1
|
||||
# environment
|
||||
LOGNAME = ruidy
|
||||
# environment
|
||||
APPLICATION_INSIGHTS_NO_DIAGNOSTIC_CHANNEL = true
|
||||
# environment
|
||||
ZSH = /Users/ruidy/.oh-my-zsh
|
||||
# environment
|
||||
VSCODE_HANDLES_UNCAUGHT_ERRORS = true
|
||||
# automatic
|
||||
^D = $(patsubst %/,%,$(dir $^))
|
||||
# environment
|
||||
XPC_FLAGS = 0x0
|
||||
# environment
|
||||
COLORTERM = truecolor
|
||||
# default
|
||||
MAKE = $(MAKE_COMMAND)
|
||||
# environment
|
||||
LC_TERMINAL = iTerm2
|
||||
# environment
|
||||
SHLVL = 3
|
||||
# default
|
||||
MAKE_VERSION := 3.81
|
||||
# environment
|
||||
USER = ruidy
|
||||
# makefile
|
||||
.DEFAULT_GOAL := cli
|
||||
# default
|
||||
MAKECMDGOALS := all
|
||||
# environment
|
||||
TERM_SESSION_ID = w0t0p0:5617C3EF-E50D-4121-8BC4-192A3B141DF3
|
||||
# environment
|
||||
LESS = -R
|
||||
# automatic
|
||||
%D = $(patsubst %/,%,$(dir $%))
|
||||
# default
|
||||
MAKE_COMMAND := /Applications/Xcode.app/Contents/Developer/usr/bin/make
|
||||
# environment
|
||||
TERM_PROGRAM = iTerm.app
|
||||
# default
|
||||
.VARIABLES :=
|
||||
# environment
|
||||
TMPDIR = /var/folders/1r/l9hbvtfx3d945mtjwqyzhtj80000gn/T/
|
||||
# automatic
|
||||
*F = $(notdir $*)
|
||||
# environment
|
||||
VSCODE_IPC_HOOK = /Users/ruidy/Library/Application Support/Code/1.57.1-main.sock
|
||||
# makefile
|
||||
MAKEFLAGS = Rrqp
|
||||
# environment
|
||||
MFLAGS = -Rrqp
|
||||
# automatic
|
||||
*D = $(patsubst %/,%,$(dir $*))
|
||||
# environment
|
||||
TERM_PROGRAM_VERSION = 3.4.8
|
||||
# environment
|
||||
XPC_SERVICE_NAME = 0
|
||||
# environment
|
||||
LC_TERMINAL_VERSION = 3.4.8
|
||||
# automatic
|
||||
+D = $(patsubst %/,%,$(dir $+))
|
||||
# automatic
|
||||
+F = $(notdir $+)
|
||||
# environment
|
||||
ITERM_SESSION_ID = w0t0p0:5617C3EF-E50D-4121-8BC4-192A3B141DF3
|
||||
# environment
|
||||
COLORFGBG = 15;0
|
||||
# environment
|
||||
__CF_USER_TEXT_ENCODING = 0x1F5:0x0:0x0
|
||||
# environment
|
||||
COMMAND_MODE = unix2003
|
||||
# default
|
||||
MAKEFILES :=
|
||||
# automatic
|
||||
<F = $(notdir $<)
|
||||
# environment
|
||||
ITERM_PROFILE = Default
|
||||
# environment
|
||||
PAGER = less
|
||||
# environment
|
||||
LC_ALL = C
|
||||
# environment
|
||||
SECURITYSESSIONID = 186aa
|
||||
# environment
|
||||
SPACESHIP_ROOT = /Users/ruidy/.oh-my-zsh/custom/themes/spaceship-prompt
|
||||
# automatic
|
||||
^F = $(notdir $^)
|
||||
# default
|
||||
SUFFIXES :=
|
||||
# default
|
||||
.INCLUDE_DIRS = /usr/local/include
|
||||
# environment
|
||||
MAKELEVEL := 0
|
||||
# environment
|
||||
LANG = C
|
||||
# environment
|
||||
TERM = xterm-256color
|
||||
# environment
|
||||
VSCODE_PID = 27251
|
||||
# variable set hash-table stats:
|
||||
# Load=85/1024=8%, Rehash=0, Collisions=4/109=4%
|
||||
|
||||
# Pattern-specific Variable Values
|
||||
|
||||
# No pattern-specific variable values.
|
||||
|
||||
# Directories
|
||||
|
||||
|
||||
# No files, no impossibilities in 0 directories.
|
||||
|
||||
# Implicit Rules
|
||||
|
||||
# No implicit rules.
|
||||
|
||||
# Files
|
||||
|
||||
cli:
|
||||
# Phony target (prerequisite of .PHONY).
|
||||
# Implicit rule search has not been done.
|
||||
# File does not exist.
|
||||
# File has not been updated.
|
||||
# commands to execute (from `/Users/ruidy/Dev/_Perso/deno/hello-server/Makefile', line 3):
|
||||
deno run cli.ts
|
||||
|
||||
|
||||
# Not a target:
|
||||
all:
|
||||
# Command-line target.
|
||||
# Implicit rule search has been done.
|
||||
# File does not exist.
|
||||
# File has not been updated.
|
||||
# variable set hash-table stats:
|
||||
# Load=0/32=0%, Rehash=0, Collisions=0/0=0%
|
||||
|
||||
.PHONY: lint cli run
|
||||
# Implicit rule search has not been done.
|
||||
# Modification time never checked.
|
||||
# File has not been updated.
|
||||
# commands to execute (from `/Users/ruidy/Dev/_Perso/deno/hello-server/Makefile', line 8):
|
||||
deno lint --unstable
|
||||
|
||||
|
||||
tests:
|
||||
# Implicit rule search has not been done.
|
||||
# Modification time never checked.
|
||||
# File has not been updated.
|
||||
# commands to execute (from `/Users/ruidy/Dev/_Perso/deno/hello-server/Makefile', line 10):
|
||||
deno test --coverage=.coverage --unstable
|
||||
deno coverage .coverage
|
||||
|
||||
|
||||
# Not a target:
|
||||
.SUFFIXES:
|
||||
# Implicit rule search has not been done.
|
||||
# Modification time never checked.
|
||||
# File has not been updated.
|
||||
|
||||
# Not a target:
|
||||
.DEFAULT:
|
||||
# Implicit rule search has not been done.
|
||||
# Modification time never checked.
|
||||
# File has not been updated.
|
||||
|
||||
# Not a target:
|
||||
/Users/ruidy/Dev/_Perso/deno/hello-server/Makefile:
|
||||
# Implicit rule search has been done.
|
||||
# Last modified 2021-05-18 09:21:00
|
||||
# File has been updated.
|
||||
# Successfully updated.
|
||||
# variable set hash-table stats:
|
||||
# Load=0/32=0%, Rehash=0, Collisions=0/0=0%
|
||||
|
||||
run:
|
||||
# Phony target (prerequisite of .PHONY).
|
||||
# Implicit rule search has not been done.
|
||||
# File does not exist.
|
||||
# File has not been updated.
|
||||
# commands to execute (from `/Users/ruidy/Dev/_Perso/deno/hello-server/Makefile', line 6):
|
||||
deno run --allow-net server.ts
|
||||
|
||||
|
||||
lint:
|
||||
# Phony target (prerequisite of .PHONY).
|
||||
# Implicit rule search has not been done.
|
||||
# File does not exist.
|
||||
# File has not been updated.
|
||||
|
||||
# files hash-table stats:
|
||||
# Load=9/1024=1%, Rehash=0, Collisions=0/26=0%
|
||||
# VPATH Search Paths
|
||||
|
||||
# No `vpath' search paths.
|
||||
|
||||
# No general (`VPATH' variable) search path.
|
||||
|
||||
# # of strings in strcache: 1
|
||||
# # of strcache buffers: 1
|
||||
# strcache size: total = 4096 / max = 4096 / min = 4096 / avg = 4096
|
||||
# strcache free: total = 4045 / max = 4045 / min = 4045 / avg = 4045
|
||||
|
||||
# Finished Make data base on Sun Jun 27 15:52:43 2021
|
||||
|
||||
|
||||
make: *** No rule to make target `all'. Stop.
|
||||
|
||||
10
Makefile
10
Makefile
|
|
@ -1,11 +1,11 @@
|
|||
.PHONY: cli
|
||||
cli:
|
||||
deno run cli.ts
|
||||
.PHONY: run
|
||||
run:
|
||||
deno run --allow-net server.ts
|
||||
.PHONY: lint
|
||||
deno run --watch --allow-net src/main.ts
|
||||
lint:
|
||||
deno lint --unstable
|
||||
test: tests
|
||||
tests:
|
||||
deno test --coverage=.coverage --unstable
|
||||
deno coverage .coverage
|
||||
deno coverage .coverage
|
||||
.PHONY: cli run lint test tests
|
||||
40
server.ts
40
server.ts
|
|
@ -1,40 +0,0 @@
|
|||
import { Application, Router, RouterContext } from "./deps.ts";
|
||||
import { ID, sayHello, sayRandomHello } from "./src/index.ts";
|
||||
import { htmlBody } from "./view.ts";
|
||||
|
||||
const port = 8000;
|
||||
|
||||
type AppOpts = { port: number };
|
||||
const getApplication = ({ port }: AppOpts): Application => {
|
||||
const router = new Router();
|
||||
|
||||
router.get("/", (ctx: RouterContext) => {
|
||||
ctx.response.body = htmlBody(sayRandomHello());
|
||||
}).get("/:id", (ctx: RouterContext) => {
|
||||
try {
|
||||
const value = ctx.params.id;
|
||||
if (value) {
|
||||
const id = new ID(parseInt(value, 10));
|
||||
ctx.response.body = htmlBody(sayHello(id));
|
||||
}
|
||||
} catch (error) {
|
||||
console.error(error);
|
||||
ctx.response.body = error.message;
|
||||
}
|
||||
});
|
||||
|
||||
const app = new Application();
|
||||
|
||||
app.use(router.routes());
|
||||
|
||||
app.addEventListener(
|
||||
"listen",
|
||||
() => console.log(`Server listening on http://localhost:${port}/`),
|
||||
);
|
||||
return app;
|
||||
};
|
||||
|
||||
const app = getApplication({ port });
|
||||
|
||||
await app.listen({ port });
|
||||
console.log(`Finished`);
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
import { readLines } from "./deps.ts";
|
||||
import { ID, sayHello, sayRandomHello, ValidationError } from "./src/index.ts";
|
||||
import { ID, sayHello, sayRandomHello, ValidationError } from "./mod.ts";
|
||||
|
||||
const start = async () => {
|
||||
console.log("Hello, World! (International version)\n");
|
||||
|
|
@ -6,4 +6,8 @@ export {
|
|||
} from "https://deno.land/std@0.87.0/testing/asserts.ts";
|
||||
export { readLines } from "https://deno.land/std@0.87.0/io/bufio.ts";
|
||||
export { Application, Router } from "https://deno.land/x/oak/mod.ts";
|
||||
export type { RouterContext } from "https://deno.land/x/oak/mod.ts";
|
||||
export type {
|
||||
RouteParams,
|
||||
RouterContext,
|
||||
} from "https://deno.land/x/oak/mod.ts";
|
||||
export { Random } from "https://deno.land/x/random/Random.js";
|
||||
9
src/main.ts
Normal file
9
src/main.ts
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
import { router } from "./routes.ts";
|
||||
import { getApplication } from "./server.ts";
|
||||
|
||||
const port = 8000;
|
||||
|
||||
const app = getApplication({ port, router });
|
||||
|
||||
await app.listen({ port });
|
||||
console.log(`Finished`);
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
import { assertEquals } from "../../deps.ts";
|
||||
import { assertEquals } from "../deps.ts";
|
||||
import { getLocaleById, Locale } from "./locales.ts";
|
||||
|
||||
Deno.test("Get locale by id", () => {
|
||||
|
|
|
|||
24
src/routes.ts
Normal file
24
src/routes.ts
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
import { Router, RouterContext } from "./deps.ts";
|
||||
import { ID, sayHello, sayRandomHello } from "./mod.ts";
|
||||
import { htmlBody } from "./view.ts";
|
||||
|
||||
export const router = new Router();
|
||||
|
||||
router.get("/", (ctx: RouterContext) => {
|
||||
ctx.response.body = htmlBody(sayRandomHello());
|
||||
});
|
||||
|
||||
router.get<
|
||||
Record<string, string | undefined>
|
||||
>("/:id", (ctx: RouterContext) => {
|
||||
try {
|
||||
const value = ctx.params.id;
|
||||
if (value && value !== "favicon.ico") {
|
||||
const id = new ID(parseInt(value, 10));
|
||||
ctx.response.body = htmlBody(sayHello(id));
|
||||
}
|
||||
} catch (error) {
|
||||
console.error(error);
|
||||
ctx.response.body = error.message;
|
||||
}
|
||||
});
|
||||
15
src/server.ts
Normal file
15
src/server.ts
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
import { Application, Router } from "./deps.ts";
|
||||
|
||||
type AppOpts = { port: number; router: Router };
|
||||
|
||||
export const getApplication = ({ port, router }: AppOpts): Application => {
|
||||
const app = new Application();
|
||||
|
||||
app.use(router.routes());
|
||||
|
||||
app.addEventListener(
|
||||
"listen",
|
||||
() => console.log(`Server listening on http://localhost:${port}/`),
|
||||
);
|
||||
return app;
|
||||
};
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
import { assertThrows } from "../../deps.ts";
|
||||
import { assert, assertThrows, Random } from "../deps.ts";
|
||||
import { ValidationError } from "../errors/exceptions.ts";
|
||||
import { ID } from "./id.ts";
|
||||
|
||||
|
|
@ -9,3 +9,9 @@ Deno.test("ID validation fails for non strictly positive values", () => {
|
|||
Deno.test("Hello fails for too large values", () => {
|
||||
assertThrows(() => new ID(666), ValidationError, `Invalid index: 666`);
|
||||
});
|
||||
|
||||
Deno.test("ID is valid", () => {
|
||||
const value = new Random().int(1, 77);
|
||||
const id = new ID(value);
|
||||
assert(id);
|
||||
});
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
import { assertEquals, assertStrictEquals } from "../../deps.ts";
|
||||
import { assertEquals, assertStrictEquals } from "../deps.ts";
|
||||
import { ID } from "../types/id.ts";
|
||||
import { HelloResponse, sayHello, sayRandomHello } from "./hello.ts";
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
import { Locale } from "./src/repositories/locales.ts";
|
||||
import { Locale } from "./repositories/locales.ts";
|
||||
|
||||
export const htmlBody = ({ locale: language, message: hello }: Locale) =>
|
||||
`<!DOCTYPE html>
|
||||
Loading…
Reference in a new issue