Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save nimatrazmjo/cde684ea0537bee9f599f9015f4c53e7 to your computer and use it in GitHub Desktop.
Save nimatrazmjo/cde684ea0537bee9f599f9015f4c53e7 to your computer and use it in GitHub Desktop.
RESTful API sample structure using Node.js, Express.js included tesing
Let's lool at the following example structure for RESTful API using Node.js, Express.js included tesing
app/
|---models/
|---controller/
|---helpers/
|---middlewares/
|---tests/
|---models/
|---controllers/
|---middlewares/
|---node_modules/
|---app.js
|---package.json
models/ – represents data, implements business logic and handles storage
controllers/ – defines your app routes and their logic
helpers/ – code and functionality to be shared by different parts of the project
middlewares/ – Express middlewares which process the incoming requests before handling them down to the routes
tests/ – tests everything which is in the other folders
node_modules/ - all npm requried for app
app.js – initializes the app and glues everything together
package.json – remembers all packages that your app depends on and their versions
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment