1.0.8 • Published 4 years ago
simplify-express v1.0.8
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 usehttp://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