Code Monkey home page Code Monkey logo

express-api-template's Introduction

Express API

A simple and improved api with ExpressJS.

Language PyVersion

๐Ÿ—ƒ | Dependecies

Dependencie Version
cookie-parser ~1.4.4
cors, ^2.8.5
dotenv ^16.0.2
express ~4.16.1
morgan ~1.9.0
nodemon ^2.0.2

โ“ | How to Start?

First let's clone the repository.

$ git clone https://github.com/Ahosall/express-api-template.git

Go to the directory where the project was cloned and we will install the dependencies.

$ npm install

To start the project there are two ways:

  • Production:

    $ npm start
  • Development:

    $ npm run dev

๐Ÿ“ถ | Routes

I made some changes in the structure of both the code and the folders. The routes are in the src > routes folder. To keep a pattern of files I made a treatment to get the first name of the file.

Example:

clients.route.js

The route in the middle of the names is not mandatory, it's just a way of organizing :>

The code inside each file follows the following structure:

module.exports = [
   {
     path: "/", // Path of the route
     method: "GET", // Method to execute the route
     router: (req, res) => { // Where the magic happens~
         res.json({message: "Hiii, world!"})
     },
   },
]

I did it this way to avoid having to import the router function from express... and to maintain a greater view. :>

๐Ÿ›‚ | Controllers & Models

Well, controllers and models follow the same patterns as always, feel free to create an issue with a new way of programming! :>

If you find bugs, report them in the issues. \(๏ฟฃ๏ธถ๏ฟฃ*\)

๐Ÿ”ฐ | License

This project is licensed under the MIT License!


Made with ๐Ÿค by Ahosall (Feh's)!
All forms of contact are on my profile!

express-api-template's People

Contributors

devfeh avatar

Stargazers

 avatar  avatar

Watchers

 avatar

Forkers

lipooliveira

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.