-
4.1 Die API nutzt basic authorization for protection
4.2 server-adresses local
4.3 Healthcheck
4.4 Swagger-ui -
5.1 GET routes
5.2 POST routes
5.3 DELETE routes
5.4 PUT routes -
6.1 GET routes
6.2 POST routes
6.1 DELETE routes
6.2 PUT routes
- This repo was created for people who are study or just want to take a look at some SQL & NoSQL API examples
- There's a
api-request-examples.json
where you can take a look at API request examples - You need to download the data content before using the WebApp
- I hosted the WebApp on AWS therefore there's a
buildspec.yml
file for an CodePipeline - Furthermore it was hosted in an Elastic Beanstalk so you may find
.ebextensions
interesting - Additionally I hosted the WebApp on Fargate, so I created a Docker Container, you may take a glimpse at the
Dockerfile
and thedocker-compose.yml
- You can checkout the NoSQL Docker Image on Docker repository.
- start visual studio code
- create .env file and copy variables from dot.env.template
- click on NPM scripts
- click on install-app
- start docker-compose-dev
- start (for prod) or start-dev (for dev)
- stop docker-compose
- close app terminal
user=admin
pw=${SUPERSECRET}
in dot.env.template
http://localhost:3000 -> app
http://localhost:3001 -> phpmyadmin (GUI MariaDB)
http://localhost:8081 -> mongo-express (GUI MongoDB)
http://localhost:3000/healthcheck
http://localhost:3000/api-docs
Sequelize creates all tables for you and checks them everytime the app gets restart. Only Thing is you need to create the views for the statistic and the overview. You can find the necessary information in the sql-view.sql
and scenario_uber.sql
http://localhost:3000/sql/get/client
http://localhost:3000/sql/get/client/:id
http://localhost:3000/sql/get/driver
http://localhost:3000/sql/get/driver/:id
http://localhost:3000/sql/get/ride
http://localhost:3000/sql/get/ride/:id
http://localhost:3000/sql/get/waypoint
http://localhost:3000/sql/get/waypoint/:id
http://localhost:3000/sql/get/amount
http://localhost:3000/sql/get/count
http://localhost:3000/sql/post/client
http://localhost:3000/sql/post/driver
http://localhost:3000/sql/post/ride
http://localhost:3000/sql/post/waypoint
http://localhost:3000/sql/delete/client/:id
http://localhost:3000/sql/delete/driver/:id
http://localhost:3000/sql/delete/ride
http://localhost:3000/sql/delete/waypoint/:id
http://localhost:3000/sql/update/client/:id
http://localhost:3000/sql/update/driver/:id
http://localhost:3000/sql/update/ride/:id
http://localhost:3000/sql/update/waypoint/:id
http://localhost:3000/sql/get/amount
http://localhost:3000/sql/get/count
http://localhost:3000/sql/get/statistics
http://localhost:3000/sql/get/overview
Migration is done automatically
http://localhost:3000/nosql/get/client
http://localhost:3000/nosql/get/client/:_id
http://localhost:3000/nosql/get/driver
http://localhost:3000/nosql/get/driver/:_id
http://localhost:3000/nosql/get/ride
http://localhost:3000/nosql/get/ride/:_id
http://localhost:3000/nosql/get/waypoint
http://localhost:3000/nosql/get/waypoint/:_id
http://localhost:3000/nosql/get/overview/
http://localhost:3000/nosql/get/overview/:_id
http://localhost:3000/nosql/get/count/
http://localhost:3000/nosql/post/client
http://localhost:3000/nosql/post/driver
http://localhost:3000/nosql/post/ride
http://localhost:3000/nosql/post/waypoint
http://localhost:3000/nosql/delete/client/:_id
http://localhost:3000/nosql/delete/driver/:_id
http://localhost:3000/nosql/delete/ride/:_id
http://localhost:3000/nosql/delete/waypoint/:_id
http://localhost:3000/nosql/update/client/:_id
http://localhost:3000/nosql/update/driver/:_id
http://localhost:3000/nosql/update/ride/:_id
http://localhost:3000/nosql/update/waypoint/:_id
-
dotenv:
- Another solution is using
dotenv
package. Dotenv loads environment variables from .env files into the process.env variable in Node.js
- Another solution is using
-
react:
- Framework for building frontend
-
mariadb:
- Install the mariadb Connector using npm
-
express:
- backend API framework
-
axios:
- frontend sends requests to backend
-
mongoose:
- ODM(Object-document-mapping) for mongo
-
nodemon:
- dev-tool -> app restarts automatically after saving
-
sequelize:
- ORM(Object-relational-mapping) for mariadb
This work is licensed under a Creative Commons Attribution 4.0 International License.