shopapp
shopapp copied to clipboard
Demo webapp built with Jester, Norm, and Norman.
Shop App with Karax, Jester, Norm, and Norman
This is a proof-of-concept for a webapp created with Karax for frontend, Jester for API server, Norm for ORM, and Norman for migration management.
Usage
- Clone the repo and
cd
into the repo dir:
.. code-block::
$ git clone [email protected]:moigagoo/shop-api.git
$ cd shop-api
- Create
.env
from.env_example
:
.. code-block::
$ cp .env_example .env
- Build the image:
.. code-block::
$ docker-compose build
- Start
web
service and enter the container:
.. code-block::
$ docker-compose run --rm --service-ports web bash
- Apply the migrations:
.. code-block::
$ norman migrate
- Run the app:
.. code-block::
$ nimble run --deepcopy:on
-
Open your browser at
localhost:5000
and play around. -
Send requests to it in a separate terminal:
.. code-block::
$ curl -s http://localhost:5000/api/customers/1 | jq
{
"auth": {
"email": "[email protected]",
"googleToken": "",
"id": 1
},
"name": "Alice 1",
"age": 21,
"id": 1
}
$ curl -s 'http://localhost:5000/api/customers/?page=3&per_page=2' | jq
[
{
"auth": {
"email": "[email protected]",
"googleToken": "",
"id": 5
},
"name": "Alice 5",
"age": 25,
"id": 5
},
{
"auth": {
"email": "[email protected]",
"googleToken": "",
"id": 6
},
"name": "Alice 6",
"age": 26,
"id": 6
}
]
$ curl -X DELETE -s http://localhost:5000/api/customers/2
$ curl -X POST --data '[email protected]&token=AbC123' http://localhost:5000/api/customers/
11