Skip to content

Michelalmeidasilva/api-feira-online-neo4j

Repository files navigation

API using Node.js, neo4j database, GraphQL, TypeScript, Hapi, and Express 4.

Getting Started

Installation

  1. Install Node.JS LTS version
  2. Install neo4j
  3. Clone this repository and navigate to the cloned directory.
  4. Install dependencies by running: yarn or npm install

Before running the project:

1. Create a database in neo4j desktop.

image

2. Create a new user, to do this, enter the neo4j desktop browser mode and go to the command input.

  • First, check which users exist in your database. When freshly created, only the 'neo4j' user will appear. Use the command SHOW USERS to view.
  SHOW USERS

image

  • The following command will create an 'admin' user with the password 'EXAMPLE@PASSWORD'.
      CREATE USER example_admin IF NOT EXISTS
       SET PLAINTEXT PASSWORD 'EXAMPLE@PASSWROD'
       SET PASSWORD CHANGE REQUIRED
       SET STATUS ACTIVE
       SET HOME DATABASE neo4j 

For more user creation options, refer to create-users

  • The following command will grant the 'admin' role to the 'example_admin' user.
   GRANT ROLE admin, PUBLIC TO example_admin

For more information, visit: neo4j managing users

3. Copy the .env and add your values to variables.

$ cp .env.example .env

Example .env file:

 PORT=8000
 URL_DATABASE= neo4j://localhost:7687
 USERNAME_DATABASE= admin
 PASSWORD_DATABASE= example123
 DATABASE_NAME= neo4j

Running the Project

  1. Run the command yarn start in the terminal to start the server.
$michel  `yarn start`
  1. To run the tests, use the command yarn test:
$michel  `yarn test`
  1. To test the API:

To test the API, you can use tools like Postman or Insomnia to create requests and view the API's responses.

Example:

Styleguide

If you use VSCode, it's a good choice to download the ESLint and Prettier extensions.

Database

The database documentation is available at: Neo4j Documentation - FeiraOnline

Deployment Process

Refer to the document Deploy for deployment instructions.

About

A template for building APIs using Node.js, NEO4J and express.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published