Skip to content

Starter app for server rendered Express applications using TailwindCSS, Nunjucks and Postgres

License

Notifications You must be signed in to change notification settings

HugoDF/express-server-render-starter

This branch is 1 commit ahead of master.

Folders and files

NameName
Last commit message
Last commit date

Latest commit

a5be248 · Jan 6, 2023
Apr 8, 2020
Apr 8, 2020
Apr 8, 2020
Jun 4, 2020
Jun 16, 2019
Jun 16, 2019
Jun 16, 2019
Apr 8, 2020
Jun 16, 2019
Jun 16, 2019
Jun 16, 2019
Jun 16, 2019
Jul 28, 2021
Apr 8, 2020
Jun 16, 2019
Jun 16, 2019
Jan 6, 2023

Repository files navigation

Express Server-Render Starter

A starter project for server-rendered Express applications using Nunjucks, TailwindCSS and Postgres

Setup

Pre-requisites:

  • Docker for Desktop

Run docker-compose up in the root of the project.

It will bring up Postgres and the Express application server in development mode.

It binds the application server to localhost:3000, this can be re-mapped this by changing the first 3000 in 3000:3000 of ./docker-compose.yaml).

The default Docker CMD is npm start, ./docker-compose.yaml overrides this to npm run dev which runs the application using nodemon (auto-restart on file change).

Express setup

The Express "page" resources are located in ./src/pages.

Their corresponding Nunjucks templates are in ./src/views.

Applications routes for pages are defined in ./src/router.js.

Global concerns like security, cookie parsing, body parsing and request logging are handled in ./server.js.

This application loosely follows the Presentation Domain Data Layering:

  • Presentation is dealt with in the ./src/pages folder
  • Domain is dealt with in the ./src/modules folder.
  • Persistence is dealt with in the ./src/persistence folder.