Git Product home page Git Product logo

restapify's Introduction

Restapify

restapify cover

npm test workflow codecov This projet uses SemVer for versioning Gitmoji

Restapify is a tool that allows you to quickly and easily deploy a local REST API by using an intuitive and developer friendly JSON file structure.


Summary

Why Restapify

When you start a new frontend project when the backend is not yet ready, you quickly come to the question of how to retrieve the data to be displayed. There are then many solutions that come with advantages but also some inconveniences. It's possible to use a tool like postman but it's not 100% free and require an account, to simply fetch local JSON data but it only supports a GET request or use a mocker library like json-server, mocker-api or http-fake-backend.

The problem of most of this libraries is the way you have to define your API endpoints (a single file for all the routes, javascript files that took almost the same time to code than the real API, ...). Restapify try to make this process even faster with a file structure close to the one that you can see in Nextjs or Sapper and some developer friendly syntaxes to populate your json files.

Features

  • ๐Ÿ’ก Incredible DX - Intuitive files structure and JSON syntax
  • โœ… JSON valid - You will only use .json files that follows the ECMA-404 standard
  • ๐ŸŽ› Dashboard - Out of the box SPA to explore and manage your mocked API
  • ๐Ÿ’ป CLI - Use the CLI for an instant deployment
  • ๐Ÿ”ฅ Built in hot watcher - Directly see your changes after a file update
  • ๐Ÿ“ Fakerjs implementation - Intuitive syntax to quickly populate your API responses
  • ๐Ÿšจ Events handler - Execute callbacks on specific events
  • ๐Ÿท๏ธ TypeScript support

Getting Started

Using the cli

The simplest way to use Restapify is to use his cli:

npm i -g restapify

and then serve the api folder:

restapify serve path/to/folder/

Using the JavaScript class

You can install restapify's class using npm (note that this package should be a devDependency):

npm i -D restapify

You can then import the class and instantiate it to serve the api folder:

import * as path from 'path'
import Restapify from 'restapify'

const apiFolderPath = path.resolve(__dirname, './path/to/folder')

const rpfy = new Restapify({
  rootDir: apiFolderPath
})
rpfy.run()

Documentation

Checkout the documentation on the website or directly read it from the Markdown source file.

Contributing

All remarks are welcome so feel free to open an issue. Wants to collaborate? Please read the contributing guidelines.

restapify's People

Contributors

johannchopin 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.