Skip to content

osaxon/ez-poll-be

Repository files navigation

EZ Poll

A web-socket service and API built with Node.JS, Express and Socket.IO.

Features

  • 🏃 Node.js: A JavaScript runtime built on Chrome's V8 JavaScript engine, designed for building scalable network applications.

  • 🔌 Socket.IO A web-socket server framework for the Node runtime.

  • 🔐 Auth0 API routes protected with JWT's with authentication provided by Auth0.

  • 🥽 TypeScript: A superset of JavaScript that adds static typing, enabling a more robust development experience and improved code quality.

  • 🍔 Express: A fast, unopinionated, minimalist web framework for Node.js, designed for building web and mobile applications.

  • 🌦️ Drizzle ORM: A lightweight ORM library for Node.js, providing a convenient way to interact with Postgres databases.

  • 🤡 Jest and Supertest: Jest is a JavaScript testing framework with a focus on simplicity. Supertest is a library for testing HTTP assertions with Jest.

Getting Started

  1. Clone the repository:

    git clone https://github.com/your-username/your-project.git
    cd your-project
  2. Install dependencies:

    npm install
  3. Configure the Database:

    Create a .env file in the project root and update with the following:

     NODE_ENV=development
     PORT=3000
     CONNECTION_STRING=postgres://{user}:{pass}@{host}:{port}/{database}
     SESSION_SECRET=TEMP_SECRET
     TEST_USER_PASSWORD=password123
  4. Run Migrations:

    Run the database migrations to set up the initial schema.

    npm run migrations
  5. Start the Development Server:

    npm run dev

    The server will be running at http://localhost:3000.

Scripts

  • npm run dev: Start the development server with automatic reload on code changes.

  • npm run start: Start the production server.

  • npm run test: Run Jest tests.

  • npm run db-studio: Start the Drizzle Kit studio.

  • npm run migrations: Run database migrations.

Project Structure

your-project/
|-- src/
|   |-- controllers/       # Express route controllers
|   |-- db/                # Database configuration and migrations
|   |-- middleware/        # Express middleware
|   |-- routes/            # Express routes
|   |-- app.ts             # Express app setup
|-- tests/                 # Jest test files
|-- .babelrc               # Babel configuration (for Jest)
|-- .eslintrc.json         # ESLint configuration
|-- jest.config.js         # Jest configuration
|-- package.json           # Project dependencies and scripts
|-- tsconfig.json          # TypeScript configuration
|-- README.md              # Project documentation

Testing

Jest and Supertest are used for testing. Write your tests in the tests directory and run them with npm run test.

npm run test

Contributing

Feel free to contribute to this starter template. Create issues, fork the repository, and submit pull requests. Your feedback and contributions are highly appreciated!

License

This project is licensed under the MIT License - see the LICENSE file for details.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published