Giter Club home page Giter Club logo

pet-store's Introduction

Pet-Store API Meta-System

This project is a practical implementation of the PetStore API in Meta-System. You can use it as a base to create your own system or even just clone this repo and test it for fun.

Running this System

Requirements

  • Having nodejs installed (12.x or greater)
  • Installing Meta-System with npm (npm install -g meta-system)
  • Have an instance of MongoDB running with the right credentials

After all the requirements are met, just run meta-system ./petstore.json while in the root of this repo.

Setting up the Database

We need to have an instance of MongoDB running, and it must have an user with the right permissions and credentials. These instructions are valid only for MongoDB version 5.x or greater.

  1. First, install MongoDB in your system according to their website instructions.
  2. After that is done, create mongod.conf file to have the base configuration of your database saved and ready to go. The details on thw available parameters for that file are here. There is also an example.mongod.conf file in this repository, which you can use as a base to configure your database, just changing the needed parts.
  3. Change the path property on that file to a valid path in your computer.
  4. Change the security > authorization value to disabled. We will enable it again after we create our user.
  5. Run your database with mongod --config </path/to/your/config>. The part between <> is the path of your database configuration file.
  6. Open another terminal window and access your running database with the mongosh --port 27017 command. The port option should match what you have set up in the other steps.
  7. Type in the command use("admin") to switch to the Admin database. We will use this to create our database user.
  8. Type in this one line command db.createUser({ user: "petStore", pwd: "1234", roles: [ {role: "userAdminAnyDatabase", db:"admin"}, {role:"readWriteAnyDatabase", db:"admin"} ] }). This creates the user we will use for our server. You may change the user and the pwd values, but be sure to change them to the same value in the dbConnectionString value of the petstore.json file.
  9. Stop your database.
  10. Change security > authorization back to enabled.
  11. Run your database again with mongod --config </path/to/your/config>.

Every subsequent start of the database will not require any other change, just execute the last step of the process above.

pet-store's People

Contributors

homemmakako avatar zelcion avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

cgb-lowcode2022

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.