/expressjs

Primary LanguageJavaScriptMIT LicenseMIT

ExpressJS Starter Template

Deploy on Railway

This is boilerplate/starter project for quickly building RESTful APIs using Node.js and Express, written in JavaScript. It will help you get started with a simple to follow format with some examples for routes, logging and middleware.

Includes

Server utilites:

  • morgan- HTTP request logger middleware for Node.js
  • dotenv- Loads environment variables from .env file into process.env
  • cors- CORS provides a Connect/Express middleware that can be used to enable CORS with various options.

Development utilites

  • nodemon- Helps develop node.js based application by automatically restarting the node server when it detects application file changes.

Commands

Setup

yarn

Development

yarn dev

About

The server runs a simple Express API server

/ returns status: ok

/hello returns message: Hello World!

Unknown endpoints are handled in a middleware file.

The hello route is defined in the helloRoute

Project Structure

src\
 |--routes\         # Routes
 |--utils\          # Utility files
 |--app.js          # Express app
 |--index.js        # App entry point