1.0.8 • Published 4 years ago

simplify-express v1.0.8

Weekly downloads
-
License
MIT
Repository
github
Last release
4 years ago

Simplify Express.js

  • Version: 1.0.8
  • Node.js


Instructions

1º Install

your@terminal:~$ npm i simplify-express

2º Create an main.js

const App = require("simplify-express")

new App()

3º Create an index.js in "./pages"

module.exports = {
  request: "/",
  method: "GET",
  run: (request, response) => response.send("Hello World!")
}

4º Run

your@terminal:~$ node index.js

5º Navigate to localhost:8080

Configurations

const App = require("simplify-express")

new App({ port: 8080, pages: "./pages", static: "./public" })

"Port" is the port that your website will use
http://localhost:8080
http://localhost:${port}

"Pages" is the folder where your pages (.js) are located
./pages/index.js
./pages/version.js

"Static" is the folder where your static files are located
./public/index.html
./public/favicon.ico

Pages

  • Single:
module.exports = {
  request: "/hello",
  method: "GET",
  run: (request, response) => {
  
     // Hello World!
     response.send("Hello World!")
     
  }
}
  • Multiples:
module.exports = {
  request: "/api",
  routes: [{
     request: "/v1",
     method: "GET",
     run: (request, response) => response.send("Version 1")
  },
  {
     request: "/v2",
     method: "GET",
     run: (request, response) => response.send("Version 2")
  }]
}

License

Copyright (c) 2020 ownfeelipe
Licensed under MIT License

1.0.8

4 years ago

1.0.7

4 years ago

1.0.6

4 years ago

1.0.5

4 years ago

1.0.4

4 years ago

1.0.3

4 years ago

1.0.2

4 years ago