Skip to content

lightweight and minimalist structure for building REST API

License

Notifications You must be signed in to change notification settings

andriann-rak/ingrid

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ingrid

lightweight and minimalist structure for building REST API

Main config

create a dotenv file in the root directory and add these line and fill

#debug config | DO NOT CHANGE
DEBUG="http server database modules info"

# server and database config
PORT=YOUR_SERVER_PORT
HOST=YOUR_SERVER_HOST
DB_URL=YOUR_DATABASE_URL_STRING_CONNECTION

Modules config

  • Create a new folder in the root path and name it modules
  • Put your module folder inside.
  • The name of your module folder will be the api url endpoint
-- Modules
   -- auth
   -- check-list
   -- users
-- index.js
-- package.json
-- ...

The module must contain at least index.js file which exposes the express router

This is for example the auth module. Here, the api endpoint will be /auth

const router = require("express").Router()
const ctrl = require("./auth.controller")

router.post("/", ctrl.login)
router.get("/check-email/:email", ctrl.checkEmail)

// this export is required
module.exports = router

About

lightweight and minimalist structure for building REST API

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published