A collection of snippets for Express.js. To initiate, you can either use shorthand methods or type an express method and rest will be autocomplete.
A collection of Expressjs snippets for Atom
Go to Settings > Install
and then search for expressjs
under Packages
.
After installing this package, please restart Atom Editor.
These snippets are for daily use to avoid writing as much as it could the boilerplate code. If you like, to add yours, feel free to contribute.
(es5 versions of methods that use keyword function
in place of =>
functions are suffix by f
)
aall
| aallf
app.all()adel
| adelf
app.delete()adisable
app.disable()adisabled
app.disabled()aenable
app.enable()aenabled
app.enabled()aget
| agetf
app.get()apost
| apostf
app.apost()aput
| aputf
app.put()alisten
| alistenf
app.listen() templatelisten
app.listen()aroute
app.route()aset
app.set()ause
app.use()rjson
res.json()rjsonp
res.jsonp()rredirect
res.redirect()rrender
res.render()rsend
res.send()rstatus
res.status()rss
res.status().send();router()
express.Router()rget
| rgetf
router.get()rpost
| rpostf
router.apost()rput
| rputf
router.put()rall
| rallf
router.all()rdel
| rdelf
router.delete()app
variableapp
const app = express();express
const express = require('express');session
const session = require('express-session');bodyparserj
app.use(bodyParser.json());bodyparserurl
app.use(bodyParser.urlencoded({extended: true}));methodoverride
app.use(methodOverride('method'));staticfile
app.use(express.static('public'));compress
app.use(compression({level:zlib.Z_DEFAULT_COMPRESSION}));helmet
app.use(helmet());logger
app.use(logger());Pull requests for more snippets are welcome. If you like to add yours, feel free to contribute.
In lieu of a formal style guide, take care to maintain the existing coding style.
Copyright (c) Aman Mittal
Good catch. Let us know what about this package looks wrong to you, and we'll investigate right away.