Coder Social home page Coder Social logo

camelaissani / frontexpress Goto Github PK

View Code? Open in Web Editor NEW
261.0 9.0 13.0 263 KB

An Express.js-Style router for the front-end

Home Page: https://frontexpressjs.com

License: MIT License

JavaScript 99.91% HTML 0.09%
front-end browser router history navigation javascript url-parsing url expressjs middleware

frontexpress's People

Contributors

camelaissani avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

frontexpress's Issues

Make Frontexpress extendable with plug-ins

For SPA it would be interesting that when you call the listen () method, you have an option to activate this feature, for example:

App.listen ({spa: true});

(Or a default feature of frontexpress)

Once this option is enabled, the listen () method internally generates a list of paths that appear as a parameter in the get methods invoked. For example:

App.get ('/ page1', (req, res) => {
   // Some-code
});

App.get ('/ page2', (req, res) => {
   // Some-code
});

It would generate an array: routes = ['page1', 'page2'], then look for tags that have those paths, use preventDefault to avoid making the request to the server and execute // Some-code when clicked on it

I think this would help keep the HTML document more semantic as it allows you to use tags like <a href="page1"> Page 1 </a> and avoid requests to the server through calls with AJAX

Sorry for my english, is not my native language

Thank you!

browser stats

normal file size, minified, gzipped?

Also is there a cdn, so people who aren't using bower could include it?

fuck the eslint

0 info it worked if it ends with ok
1 verbose cli [ 'C:\Program Files\nodejs\node.exe',
1 verbose cli 'C:\Program Files\nodejs\node_modules\npm\bin\npm-cli.js',
1 verbose cli 'run',
1 verbose cli 'lint' ]
2 info using [email protected]
3 info using [email protected]
4 verbose run-script [ 'prelint', 'lint', 'postlint' ]
5 info lifecycle [email protected]prelint: [email protected]
6 silly lifecycle [email protected]
prelint: no script for prelint, continuing
7 info lifecycle [email protected]lint: [email protected]
8 verbose lifecycle [email protected]
lint: unsafe-perm in lifecycle true
9 verbose lifecycle [email protected]lint: PATH: C:\Program Files\nodejs\node_modules\npm\bin\node-gyp-bin;E:\test\frontexpress\node_modules.bin;C:\Program Files\nodejs\node_modules\npm\bin\node-gyp-bin;E:\test\frontexpress\node_modules.bin;C:\Users\Administrator\bin;C:\Program Files\Git\mingw64\bin;C:\Program Files\Git\usr\local\bin;C:\Program Files\Git\usr\bin;C:\Program Files\Git\usr\bin;C:\Program Files\Git\mingw64\bin;C:\Program Files\Git\usr\bin;C:\Users\Administrator\bin;C:\Python27;C:\Python27\Scripts;C:\Program Files\ImageMagick-7.0.1-Q16;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0;C:\Windows\CCM;C:\ProgramData\chocolatey\bin;D:\Python27\Scripts;C:\Python27\Scripts;C:\Users\Administrator\AppData\Local\Programs\Python\Python36-32;C:\Users\Administrator\AppData\Local\Programs\Python\Script;C:\Python27;C:\Python27\Scripts;C:\Python36;C:\Python36\Scripts;C:\Program Files (x86)\Yarn\bin;C:\Program Files\nodejs;C:\Program Files\node profiler;D:\Program Files\TortoiseGit\bin;C:\Program Files (x86)\Microsoft VS Code\bin;C:\Users\Administrator\AppData\Local\Yarn\bin;C:\Users\Administrator\AppData\Roaming\npm;C:\Program Files\Docker Toolbox;C:\Program Files\Git\usr\bin\vendor_perl;C:\Program Files\Git\usr\bin\core_perl
10 verbose lifecycle [email protected]
lint: CWD: E:\test\frontexpress
11 silly lifecycle [email protected]lint: Args: [ '/d /s /c', 'eslint .' ]
12 silly lifecycle [email protected]
lint: Returned: code: 1 signal: null
13 info lifecycle [email protected]~lint: Failed to exec lint script
14 verbose stack Error: [email protected] lint: eslint .
14 verbose stack Exit status 1
14 verbose stack at EventEmitter. (C:\Program Files\nodejs\node_modules\npm\lib\utils\lifecycle.js:283:16)
14 verbose stack at emitTwo (events.js:125:13)
14 verbose stack at EventEmitter.emit (events.js:213:7)
14 verbose stack at ChildProcess. (C:\Program Files\nodejs\node_modules\npm\lib\utils\spawn.js:40:14)
14 verbose stack at emitTwo (events.js:125:13)
14 verbose stack at ChildProcess.emit (events.js:213:7)
14 verbose stack at maybeClose (internal/child_process.js:887:16)
14 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:208:5)
15 verbose pkgid [email protected]
16 verbose cwd E:\test\frontexpress
17 verbose Windows_NT 6.1.7601
18 verbose argv "C:\Program Files\nodejs\node.exe" "C:\Program Files\nodejs\node_modules\npm\bin\npm-cli.js" "run" "lint"
19 verbose node v8.1.0
20 verbose npm v5.0.3
21 error code ELIFECYCLE
22 error errno 1
23 error [email protected] lint: eslint .
23 error Exit status 1
24 error Failed at the [email protected] lint script.
24 error This is probably not a problem with npm. There is likely additional logging output above.
25 verbose exit [ 1, true ]

History management?

First of all, thanks for a great library.
I wonder how I can manage history using Frontexpress? For example when building a SPA, I want to change the URL and make the page load which I've defined earlier with app instance.
I've tried using httpGet, but then back button won't work. How can I do this?
Thanks

HTTP Post/Path request not default handled by frontexpress

post and path methods are not completely implemented

application.httpPost({
    uri: '/users',
    data: { firstname: 'John', lastname: 'Doe'}
});

The data sent to the server are not default handled by frontexpress.
Currently, the user have to implement himself the post patch methods to encode the data sent to the server.

Manage path with parameters

These routes:

/user/:id
/user/:id?

should create params object in request

Example:

app.get('/user/:firstname?/:lastname', (req, res) => {
  // if we have /user/camel/aissani then
  // req.params.firstname = 'camel'
  // req.params.lastname = 'aissani'

  // if we have /user/aissani then
  // req.params.firstname = undefined
  // req.params.lastname = 'aissani'
});

Does Service Worker API can be used to listen emitted/received AJAX requests by the application?

Currently these methods application.http(Get|Post...)(request, success, failure) are provided to make AJAX calls.
Unfortunately, those methods force developers to use a custom API for making AJAX calls rather than using the standard ones (Fetch, XHR).

May be a solution to avoid this situation is to use the Service Workers? As the SW can play the role of proxy, we can relay on it to listen requests emitted by the application.
Thus, the AJAX requests can be invoked from any frameworks (standard JS API, JQuery...) rather than using the ones provided by FrontExpress.

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.