Giter Club home page Giter Club logo

expresssnippet's Introduction

ExpressSnippet

A collection of snippets for Express.js (https://github.com/expressjs)

To initiate just type out express commands and the rest will be autocompleted.

Work In Progress

Special Thanks To

  • Matt Gabor / mattgabor - README changes
  • Travis / mallek - Added snippets
  • André Santos / dexfs - Added ES6 snippet support

Snippets

Command Description
app.all This method is like the standard app.METHOD() methods, except it matches all HTTP verbs.
app.disable Sets the Boolean setting name to false, where name is one of the properties from the app settings table.
app.disabled Returns true if the Boolean setting name is disabled (false), where name is one of the properties from the app settings table.
app.get Express GET request
app.listen Binds and listens for connections on the specified host and port. This method is identical to Node's http.Server.listen().
app.param Add callback triggers to route parameters, where name is the name of the parameter or an array of them, and callback is the callback function.
app.patch Routes HTTP PATCH request to the specifed path with the specified callback functions.
app.post Express POST request
app.put Express PUT request
app.delete Express DELETE request
app.render Returns the rendered HTML of a view via the callback function. It accepts an optional parameter that is an object containing local variables for the view.
app.route Returns an instance of a single route, which you can then use to handle HTTP verbs with optional middleware. Use app.route() to avoid duplicate route names (and thus typo errors).
app.set Assigns setting name to value, where name is one of the properties from the app settings table.
app.use Mounts the specified middleware function or functions at the specified path. If path is not specified, it defaults to “/”.
res.send Express RESPONSE object

Links

Github VS Code

License

MIT License

Copyright (c) [2017] [Vlad Marinov]

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

expresssnippet's People

Contributors

dexfs avatar mallek avatar mattgabor avatar vladmrnv avatar

Stargazers

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

Watchers

 avatar  avatar

expresssnippet's Issues

Use process.env.PORT for app.listen

Hi.

Me again. I thought of another way to improve your extension. Instead of using a static port number, like 3000, why not set it to the development environment's port? It's a small change but it will save a bit of time. Especially when switching between production and development.
Something like this:

const PORT = process.env.PORT || 3000;

app.listen(PORT, () => {
    console.log(`App listening on port ${PORT}!`);
});

Let me know what you think.

Thanks!

Extension not working

I was a very extensive user of this extension but I don't know maybe because of the update to VS code or something this extension completely stopped showing any snippet. I uninstalled and installed it multiple times but it did not solve the problem. Please look into this

ES6 syntax please

Hi.

Total Node and Express newbie here.
Just want to say I love this extension and I plan on using it a lot.

I am learning NodeJS and would like to use ES6 syntax throughout my apps. I was wondering if you would ever consider revamping this extension to use arrow functions, constants, template strings, etc.

I'm sure a lot of people use this extension too and would love it if it had ES6 syntax.

const app = require("express")();

app.get("/person/:name", (req, res) => {
    var name = req.params.name;
    res.send(`Hello, my name is ${name}`);
});

app.listen(3000, () => {
    console.log('App listening on port 3000!');
});

Thanks!

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.