Git Product home page Git Product logo

nocode-backend's Introduction

Encore - A JSON Schema based API Builder

A prototype implmenetation of JSON schema based No-Code REST API builder.

image

Getting started

To get the Node server running locally:

  • Clone this repo

  • npm install to install all required dependencies

  • (Optional) Install MongoDB Community Edition (Instructions) and run it by executing mongod

  • npm run dev to start the local server

  • Create a .env file in the root directory and add the following environment variables:

    PORT=3000
    MONGO_URI=<--Mongo URL-->
    JWT_SECRET=<--Your Secret-->
    

Code Overview

Dependencies

  • ajv - For JSON Schema Validation
  • expressjs - The server for handling and routing HTTP requests
  • express-jwt - Middleware for validating JWTs for authentication
  • jsonwebtoken - For generating JWTs used by authentication
  • mongoose - For modeling and mapping MongoDB data to javascript
  • passport - For handling user authentication
  • swagger-ui-express - For API Documentation

Application Structure

  • server.js - The entry point to our application. This file defines our express server and connects it to MongoDB using mongoose. It also requires the routes and models we'll be using in the application.
  • controllers/ - This folder contains the controllers for our API. Controllers are further referenced in the routes.
  • middlewares/ - This folder contains custom middlewares for authentication and field validations.
  • models/ - This folder contains the schema definitions for our Mongoose models.
  • routes/ - This folder contains the route definitions for our API.

Authentication

Requests are authenticated using the Authorization header. We define two express middlewares in middlewares/ that can be used to authenticate the requests. The passport_middleware middleware configures the express-jwt middleware using our application's secret and returns a 401 status code if the request cannot be authenticated. This method of authentication is useful for frontend integrations. The api_middleware middleware utilizes access key, unique to a project, to authorize requests.

Contributing

Contributions are what make the open source community such an amazing place to be learn, inspire, and create. Any contributions you make are greatly appreciated.

  1. Fork the Project
  2. Create your Feature Branch (git checkout -b feature/AmazingFeature)
  3. Commit your Changes (git commit -m 'Add some AmazingFeature')
  4. Push to the Branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

nocode-backend's People

Contributors

avishrantssh avatar

Stargazers

 avatar

Watchers

 avatar  avatar

Forkers

vishwjeet-singh

nocode-backend's Issues

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.