Skip to content

npx elm-webapp crud

Latest
Compare
Choose a tag to compare
@choonkeat choonkeat released this 24 Oct 06:44
· 9 commits to main since this release

elm-webapp crud has changed

-       crud                    generates a standard "Browser.application"
-                               with the ability to list, create, edit, and
-                               destroy "Foobar" records
+       crud <TypeName>         patch the <target_directory> with the ability
+                               to list, create, edit, and destroy "TypeName"
+                               records

Trying it with crud Article mynews where the subdirectory mynews does not exist yet

$ npx [email protected] crud Article mynews  
npx: installed 1 in 1.98s
Writing mynews/Makefile ...
Writing mynews/index.js ...
Writing mynews/lambda.js ...
Writing mynews/node.js ...
Writing mynews/scripts/wait-for-changes.js ...
Writing mynews/src/Client.elm ...
Writing mynews/src/Protocol.elm ...
Writing mynews/src/Server.elm ...
Writing mynews/src/Extra/Codec.elm ...
Writing mynews/src/Extra/Http.elm ...
creating mynews/src/Client/ArticleUI.elm ...
patching mynews/src/Client.elm ...
patching mynews/src/Client.elm ...
patching mynews/src/Client.elm ...
patching mynews/src/Client.elm ...
patching mynews/src/Client.elm ...
patching mynews/src/Client.elm ...
patching mynews/src/Client.elm ...
patching mynews/src/Client.elm ...
patching mynews/src/Client.elm ...
patching mynews/src/Client.elm ...
creating mynews/src/Protocol/Article.elm ...
patching mynews/src/Protocol.elm ...
patching mynews/src/Protocol.elm ...
patching mynews/src/Protocol.elm ...
patching mynews/src/Protocol.elm ...
patching mynews/src/Protocol.elm ...
patching mynews/src/Protocol.elm ...
creating mynews/src/Server/ArticleAPI.elm ...
patching mynews/src/Server.elm ...
patching mynews/src/Server.elm ...
patching mynews/src/Server.elm ...
patching mynews/src/Server.elm ...

  Done! Now execute:

      1. cd mynews
      2. make install
      3. make
  
$ cd mynews 
mynews$ make install
...

ready. type `make` to start server

mynews$ make
...
[ 'js' ] [ 'http' ] nodeHttpServer
[ 'js' ] [ 'http' ] server listening at 8000 ...
[ 'js' ] [ 'http' ] [watch] file changes in ./src

and visiting http://localhost:8000 will show

Screenshot 2021-10-24 at 2 37 46 PM

if you run another crud, e.g. Userinto the same directory mynews, you'll get

mynews$ npx [email protected] crud User .        
npx: installed 1 in 0.812s
creating src/Client/UserUI.elm ...
patching src/Client.elm ...
patching src/Client.elm ...
patching src/Client.elm ...
patching src/Client.elm ...
patching src/Client.elm ...
patching src/Client.elm ...
patching src/Client.elm ...
patching src/Client.elm ...
patching src/Client.elm ...
patching src/Client.elm ...
creating src/Protocol/User.elm ...
patching src/Protocol.elm ...
patching src/Protocol.elm ...
patching src/Protocol.elm ...
patching src/Protocol.elm ...
patching src/Protocol.elm ...
patching src/Protocol.elm ...
creating src/Server/UserAPI.elm ...
patching src/Server.elm ...
patching src/Server.elm ...
patching src/Server.elm ...
patching src/Server.elm ...

you'll get another CRUD feature added to the existing app 🥳

Screenshot 2021-10-24 at 2 40 22 PM

Screenshot 2021-10-24 at 2 40 39 PM