Skip to content

🍽️ A NodeJS application for supporting multilingual groceries accessible via REST API.

License

Notifications You must be signed in to change notification settings

ugobriasco/gastronomycon-server

 
 

Repository files navigation

Gastronomycon

Codacy Badge Build Status code style: prettier

Intro

This is the server-side application of Gastronomycon - a microservice for multilingual groceries. It provides and handles groceries, accessable via REST API. The default client application can be found here.

Visit the official page, collaborate to the project on GitHub, or contact the author Ugo Briasco on Slack.

Framework

Usage

Please refer to the API documentation for released versions, or check here.

Development

Prerequisites

  • node 8+
  • npm 6+
  • Nodemon 1.4+
  • mongoDB 4+
  • dependency-cruiser 4+ (for updating dependency graph)

Setup

  • Install dependencies
git clone git@github.com:ugobriasco/gastronomycon-server.git && cd gastronomycon-server
npm i
cp ./cfg.js.template ./cfg.js
mongod
npm start
  • Create the root user, by sending a POST request to http://localhost:3000/api/v1.0/signup with the following body: {"email":"ROOT_EMAIL","passowrd":"ROOT_PASSWORD","role": "Admin"}

  • Set allow_set_role_on_signup: false in ./cfg.js. This prevents guest user to sign up as Admin.

  • Optional - SignupCode In order to control the signup, it is possible to provide a signup code option, which -if enabled- requires a code during the the registration of a new user. This option can be created by an admin user as following: POST http://localhost/api/settings {"name": "signupCode", "value": "foo"}

Test

Run npm test to execute the unit and integration tests. It requires the following ftramework:

In order to check the current test coverage, run npm coverage, which requires Istanbul.

Before running the tests make sure you are serving the app via npm start.

Architecture

Dependency graph here. For updating it, run:

sh ./script/plot-dependency-graph.sh

Contributing

In lieu of a formal style guide, take care to maintain the existing coding style. Add unit tests for any new or changed functionality. Lint and test your code.

License

MIT