π½ Another coding challenge repository.
Challenge verse is a very simple demo coding platform for NodeJs Skills evaluation.
It's a restful API aimed to restaurants and delivery context.
-
First of all, you have to run
npm installon each submodule folder. In this project, you will have two main modules:-
API module, which is responsible for attend client requests and serve a very fast response ;)
-
DB module or challenverse-db, responsible for managing db connections, handling db errors, etc. This module provides Concrete classes that give a complete abstracction of db, and could be called from another module as if they where microservices.
-
-
Start api module by running
npm run start-devon api submodule. -
Execute setup script in DB module to generate database schema. So, you have to run
npm run setupand then, -
you can load example data by running
node examplesinside challengverse-db module.
All modules are configurable by setting some NODE_ENV's variables:
database: process.env.DB_NAME || 'challengeverse', username: process.env.DB_USER || 'root', password: process.env.DB_PASS || '123', host: process.env.DB_HOST || 'localhost', port: process.env.DB_PORT || '3306'
Database dialects is Mysql harcoded.
Example DB_HOST=192.168.50.145 DB_PORT=3354 node server.js into challengeverse-api module
In browser or another http client, you can request challengeverse API. Default listen port is 3000. Obviously, you can change this by setting node env variable API_PORT.
- GET /restaurants/
- GET /restaurants/:id
- POST /restaurants/:id
- DELETE /restaurants/:id
- PUT /restaurants/:id
- POST /restaurants/:id/reviews
//Example body request { "name":"Santiago Semhan", "review": "...", "rating": 5 }
- POST /restaurants/:id/meal
- POST /restaurants/:id/order
//Example body request { "totalCost": 58, "address": "test address", "latLng":{ "lat":37.769808, "lng":-122.4705595 }, "meals": [1,2,3] //Arrays of meals Ids }
π§ Better doc under construction ...
Author: Santiago Semhan santiagosemhan@gmail.com π¦π·
License: MIT β€οΈ