Coder Social home page Coder Social logo

conduit's Introduction

Conduit

Description

Example Node (Express + Postgres) codebase containing real world examples (CRUD, auth, advanced patterns, etc) that adheres to the an API spec.

Setup

Dependencies

  • NodeJS - A JavaScript runtime environment
  • Express - A web application framework for NodeJS
  • PostgreSQL - A relational database management system that extends SQL
  • Sequelize - A promise-based ORM for NodeJS
  • Passport - An authentication middleware for NodeJS

Getting Started

Follow these steps to set up the project in development mode

  • Install Nodejs
  • Install and setup PostgreSQL
  • Clone the repository by running the command
    git clone https://github.com/victorjambo/conduit.git
    
  • Run cd conduit to enter the application's directory
  • Install the application's dependencies by running the command
    yarn install
    
  • Create a .env file in the root of your directory using the .env.example file in the repository
  • Setup the database and migrations (see database setup)
  • Start the application by running
    yarn run start:dev
    
    The application should now be running at http://127.0.0.1:5000

Database and ORM

  • Create a database in PostgreSQL and name it conduit

  • Set the following environment variables in .env:

    • DATABASE_USERNAME - this is the database username
    • DATABASE_PASSWORD - this is the database password. Ignore if you don't have a database password
    • DATABASE_NAME - set this to conduit
  • Run database migrations

    yarn run db:migrate
    
  • Check the database and confirm that the users table has been created

More about environmental variables

After setting up your .env from the template provided in the .env.example file, to use these variables anywhere in the app;

  • import the dotenv package
import dotenv from 'dotenv'
  • Make it available for use as early as possible in that file
dotenv.config()
  • Access any variable in the .env
process.env.MY_ENV_VARIABLE

Testing

Jest is used as the testing framework for both the unit tests and integration tests. To execute all tests, run the command

  yarn test or make test

Author

Victor Mutai ([email protected])

License

MIT License

conduit's People

Watchers

James Cloos avatar  avatar

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.