Giter Site home page Giter Site logo

express-vercel's Introduction

Vercel Express API boilerplate

Opinionated Node.js template for creating simple APIs and PoCs using Express1 on Vercel's serverless platform.

Motivation

Simply put, I got tired of having to do the same dance EVERY SINGLE TIME I needed to quickly spin up an API for a POC I'm working on, or small (micro? ๐Ÿ˜) services I spin up.

Usage

Making use of this template is pretty straightforward. Three ways...

  1. Clone it,
  2. Fork it, or,
  3. Even better, generate a new project on Github using this as a template.

Project Structure

.
โ”œโ”€โ”€ app.js
โ”œโ”€โ”€ config/
โ”œโ”€โ”€ controllers/
โ”œโ”€โ”€ node_modules/
โ”œโ”€โ”€ package.json
โ”œโ”€โ”€ routes/
โ”‚   โ”œโ”€โ”€ demo.route.js
โ”‚   โ””โ”€โ”€ index.js
โ”œโ”€โ”€ services/
โ”œโ”€โ”€ common/
โ”œโ”€โ”€ vercel.json
โ””โ”€โ”€ yarn.lock

Brief Overview

app.js

Express app entry point

config/

for configuration stuff... for example, database connection setup

controllers/

mostly express route handlers

node_modules/

black hole ๐Ÿ™ƒ

routes/

  • index.js โ€“ bootstraps all routes. new namespaces should always be registered here
  • demo.route.js โ€“ sample standalone route

services/

for "external" services (e.g. a weather.service.js file for interacting with darksky API)

common/

ยฏ\_(ใƒ„)_/ยฏ

Bundled Endpoints

After cloning/forking this template, the following endpoints can be immediately accessed:

  • GET /
  • GET /demo

1 depending on your use-case, making use of Express with Vercel's serverless platform may not be ideal as they suggest making use of the helpers provided for handling requests and making use of the Vercel config file for routing.

While I do make use of the helpers and routing for some projects (sample), I also love using Express as it drastically reduces routing complexity, I've not had any issues with setup, AND, it makes whatever project developed platform agnostic.

express-vercel's People

Contributors

akhilome avatar dependabot[bot] 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.